*************************************************************************************
***PLACEMENT SCALES
****party placement scales for all combinations
generate A2037_1=.
generate A2037_2=.
generate A2037_3=.
generate A2037_4=.
generate A2037_5=.
generate A2037_6=.
generate A2037_7=.
generate A2037_8=.
generate A2037=.
label variable A2037 "version i, individual countries"

generate A2038_1=.
generate A2038_2=.
generate A2038_3=.
generate A2038_4=.
generate A2038_5=.
generate A2038_6=.
generate A2038_7=.
generate A2038_8=.
generate A2038=.
label variable A2038 "version ii, individual countries"

generate A2039_1=.
generate A2039_2=.
generate A2039_3=.
generate A2039_4=.
generate A2039_5=.
generate A2039_6=.
generate A2039_7=.
generate A2039_8=.
generate A2039=.
generate A2039_1_b=.
generate A2039_2_b=.
generate A2039_3_b=.
generate A2039_4_b=.
generate A2039_5_b=.
generate A2039_6_b=.
generate A2039_7_b=.
generate A2039_8_b=.
generate A2039_B=.
label variable A2039 "version iii, individual countries, missings as ."
label variable A2039_B "version iii, individual countries, missings as in Gordon/Segura 1997"

*Australia 1996
sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="AUS_1996"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="AUS_1996"
**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*    Each respondent�s ordering is compared to the mean of respondents 
*    sequence, and for each party, respondents are given 1 point for a 
*    correct ordering, 0 if the ordering deviates (or the respondent 
*   does not place the party). Scores are added and divided by the number of placed parties for a score ranging from 0 to 1. Errors on smaller party systems are more consequential for final scores.

*5 parties (so 5-4) to most left to most right?
*E, D, A, B, C
replace A2037_1 =1 if A3032_E< A3032_D & Z1004=="AUS_1996"
replace A2037_1 =0 if A3032_E> A3032_D & Z1004=="AUS_1996"
replace A2037_1 =0 if A3032_E == A3032_D & Z1004=="AUS_1996"
replace A2037_1 =0 if A3032_E ==. & Z1004=="AUS_1996"
replace A2037_1 =0 if A3032_D ==. & Z1004=="AUS_1996"
*list A2037_1 A3032_D A3032_E if Z1004=="AUS_1996"
*tab A2037_1 if Z1004=="AUS_1996"

replace A2037_2 =1 if A3032_D< A3032_A & Z1004=="AUS_1996"
replace A2037_2 =0 if A3032_D> A3032_A & Z1004=="AUS_1996"
replace A2037_2 =0 if A3032_D == A3032_A & Z1004=="AUS_1996"
replace A2037_2 =0 if A3032_D ==. & Z1004=="AUS_1996"
replace A2037_2 =0 if A3032_A ==. & Z1004=="AUS_1996"
*list A2037_2 A3032_D A3032_A if Z1004=="AUS_1996"
*tab A2037_2 if Z1004=="AUS_1996"

replace A2037_3 =1 if A3032_A< A3032_B & Z1004=="AUS_1996"
replace A2037_3 =0 if A3032_A> A3032_B & Z1004=="AUS_1996"
replace A2037_3 =0 if A3032_A == A3032_B & Z1004=="AUS_1996"
replace A2037_3 =0 if A3032_A ==. & Z1004=="AUS_1996"
replace A2037_3 =0 if A3032_B ==. & Z1004=="AUS_1996"
*list A2037_3 A3032_A A3032_B if Z1004=="AUS_1996"
*tab A2037_3 if Z1004=="AUS_1996"

**alost same
replace A2037_4 =1 if A3032_B< A3032_C & Z1004=="AUS_1996"
replace A2037_4 =0 if A3032_B> A3032_C & Z1004=="AUS_1996"
replace A2037_4 =1 if A3032_B == A3032_C & Z1004=="AUS_1996" 
replace A2037_4 =0 if A3032_B & A3032_C==. & Z1004=="AUS_1996"
replace A2037_4 =0 if A3032_B ==. & Z1004=="AUS_1996"
replace A2037_4 =0 if A3032_C ==. & Z1004=="AUS_1996"
*list A2037_4 A3032_B A3032_C if Z1004=="AUS_1996" 
*tab A2037_4 if Z1004=="AUS_1996"

***last 
replace A2037_5 =1 if A3032_E< A3032_C & Z1004=="AUS_1996"
replace A2037_5 =0 if A3032_E> A3032_C & Z1004=="AUS_1996"
replace A2037_5 =0 if A3032_E == A3032_C & Z1004=="AUS_1996"
replace A2037_5 =0 if A3032_E ==. & Z1004=="AUS_1996"
replace A2037_5 =0 if A3032_C ==. & Z1004=="AUS_1996"
*list A2037_5 A3032_E A3032_C if Z1004=="AUS_1996"
*tab A2037_5 if Z1004=="AUS_1996", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="AUS_1996"
*tab A2037

**)correct placement of parties on the left-right is following the 
*** suggestion of Luskin and Bullock (2005). Political knowledge scores 
*** are based on the correct placement of parties on the �correct� side of 
*** the ideological scale. Respondents are given the score 1 when they place
** a party correctly, as either left or right, and 0 if they do not, or 
*** answer don�t know (or refused). Respondents placing parties in the middle 
**of the ideological spectrum are granted a correct answer if the average of 
***respondents is also around 5. 
*** The scores are summed up and divided by the number of parties, which gives a political knowledge score between 0 and 1.

*5 parties (so 5-4) to most left to most right?
*E, D, A, B, C
replace A2038_1 =1 if A3032_A<5 & Z1004=="AUS_1996"
replace A2038_1 =1 if A3032_A==5 & Z1004=="AUS_1996"
replace A2038_1 =0 if A3032_A>5  & Z1004=="AUS_1996"
replace A2038_1 =0 if A3032_A==.  & Z1004=="AUS_1996"
*tab A2038_1 if Z1004=="AUS_1996"

replace A2038_2 =1 if A3032_B>5 & Z1004=="AUS_1996"
replace A2038_2 =1 if A3032_B==5 & Z1004=="AUS_1996"
replace A2038_2 =0 if A3032_B<5  & Z1004=="AUS_1996"
replace A2038_2 =0 if A3032_B==.  & Z1004=="AUS_1996"
*tab A2038_2 if Z1004=="AUS_1996"

replace A2038_3 =1 if A3032_C>5 & Z1004=="AUS_1996"
replace A2038_3 =0 if A3032_C==5 & Z1004=="AUS_1996"
replace A2038_3 =0 if A3032_C<5  & Z1004=="AUS_1996"
replace A2038_3 =0 if A3032_C==.  & Z1004=="AUS_1996"
*tab A2038_3 if Z1004=="AUS_1996"
*list A3032_C A2038_3 if Z1004=="AUS_1996"

replace A2038_4 =1 if A3032_D<5 & Z1004=="AUS_1996"
replace A2038_4 =0 if A3032_D==5 & Z1004=="AUS_1996"
replace A2038_4 =0 if A3032_D>5  & Z1004=="AUS_1996"
replace A2038_4 =0 if A3032_D==.  & Z1004=="AUS_1996"
*list A3032_D A2038_4 if Z1004=="AUS_1996"
*tab A2038_4 if Z1004=="AUS_1996"

replace A2038_5 =1 if A3032_E<5 & Z1004=="AUS_1996"
replace A2038_5 =0 if A3032_E==5 & Z1004=="AUS_1996"
replace A2038_5 =0 if A3032_E>5  & Z1004=="AUS_1996"
replace A2038_5 =0 if A3032_E==.  & Z1004=="AUS_1996"
*list A3032_E A2038_5 if Z1004=="AUS_1996"
*tab A2038_5 if Z1004=="AUS_1996"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="AUS_1996"
*tab A2038

**version iii
***The third operationalization of political knowledge through party placements
*** uses the averaged absolute distance between respondent�s party placements 
***and the benchmark. This figure is 
***obtained by �calculating the absolute distances between the respondent�s 
***placement of each of his or her society�s political parties on a 10-point 
***ideological scale and the mean placement of those parties by the remaining 
***respondents from that society (p.133).� In order to deal with refusals and 
***don�t� knows, the authors give these respondents the mean value plus one 
***standard deviation as a penalty. The absolute distances between each of 
***respondent�s placements and the benchmark ratings added up, and then divided 
***by the number of individually placed parties for an average score

sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="AUS_1996"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="AUS_1996"

**Party A
replace A2039_1 = A5004_A-A3032_A if Z1004=="AUS_1996"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="AUS_1996"
*tab  A2039_1 if Z1004=="AUS_1996"
***missings
replace A2039_1_b = A5004_A-A3032_A if Z1004=="AUS_1996"
replace A2039_1_b= A5004_A-(4.33+2.34) if A3032_A==. & Z1004=="AUS_1996"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="AUS_1996"
*tab  A2039_1_b if Z1004=="AUS_1996"

**Party B
replace A2039_2 = A5004_B-A3032_B if Z1004=="AUS_1996"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="AUS_1996"
*tab  A2039_2 if Z1004=="AUS_1996"
***missings
replace A2039_2_b = A5004_B-A3032_B if Z1004=="AUS_1996"
replace A2039_2_b= A5004_B-(8.81) if A3032_B==. & Z1004=="AUS_1996"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="AUS_1996"
*tab  A2039_2_b if Z1004=="AUS_1996"

**Party C
replace A2039_3 = A5004_C-A3032_C if Z1004=="AUS_1996"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="AUS_1996"
*tab  A2039_3 if Z1004=="AUS_1996"
***missings
replace A2039_3_b = A5004_C-A3032_C if Z1004=="AUS_1996"
replace A2039_3_b= A5004_C-(8.99) if A3032_C==. & Z1004=="AUS_1996"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="AUS_1996"
*tab  A2039_3_b if Z1004=="AUS_1996"

**Party D
replace A2039_4 = A5004_D-A3032_D if Z1004=="AUS_1996"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="AUS_1996"
*tab  A2039_4 if Z1004=="AUS_1996"
***missings
replace A2039_4_b = A5004_D-A3032_D if Z1004=="AUS_1996"
replace A2039_4_b= A5004_D-(6.48) if A3032_D==. & Z1004=="AUS_1996"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="AUS_1996"
*tab  A2039_4_b if Z1004=="AUS_1996"

**Party E
replace A2039_5 = A5004_E-A3032_E if Z1004=="AUS_1996"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="AUS_1996"
*tab  A2039_5 if Z1004=="AUS_1996"
***missings
replace A2039_5_b = A5004_E-A3032_E if Z1004=="AUS_1996"
replace A2039_5_b= A5004_E-(6.27) if A3032_E==. & Z1004=="AUS_1996"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="AUS_1996"
*tab  A2039_5_b if Z1004=="AUS_1996"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5)/5 if Z1004=="AUS_1996"
sum  A2039 if Z1004=="AUS_1996"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b)/5 if Z1004=="AUS_1996"
sum  A2039_B if Z1004=="AUS_1996"

****************************************************************************************
*****AUS_2004 5 parties, CFBAD
*tab B5018_A if Z1004=="AUS_2004" 
*tab B5018_B if Z1004=="AUS_2004" 
*tab B5018_C if Z1004=="AUS_2004" 
*tab B5018_D if Z1004=="AUS_2004" 
*tab B5018_F if Z1004=="AUS_2004" 

*tab B3038_A if Z1004=="AUS_2004"
*tab B3038_B if Z1004=="AUS_2004"
*tab B3038_C if Z1004=="AUS_2004"
*tab B3038_D if Z1004=="AUS_2004"
*tab B3038_F if Z1004=="AUS_2004"

mvdecode B3038_A, mv(99), if Z1004=="AUS_2004"
mvdecode B3038_B, mv(99), if Z1004=="AUS_2004"
mvdecode B3038_C, mv(99), if Z1004=="AUS_2004"
mvdecode B3038_D, mv(99), if Z1004=="AUS_2004"
mvdecode B3038_F, mv(99), if Z1004=="AUS_2004"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*4 parties (so 5-4) to most left to most right?
*C F B A D
replace A2037_1 =1 if B3038_C< B3038_F & Z1004=="AUS_2004"
replace A2037_1 =0 if B3038_C> B3038_F & Z1004=="AUS_2004"
replace A2037_1 =0 if B3038_C == B3038_F & Z1004=="AUS_2004"
replace A2037_1 =0 if B3038_C ==. & Z1004=="AUS_2004"
replace A2037_1 =0 if B3038_F ==. & Z1004=="AUS_2004"
*list A2037_1 B3038_D B3038_E if Z1004=="AUS_2004"
*tab A2037_1 if Z1004=="AUS_2004", miss

replace A2037_2 =1 if B3038_F< B3038_B & Z1004=="AUS_2004"
replace A2037_2 =0 if B3038_F> B3038_B & Z1004=="AUS_2004"
replace A2037_2 =0 if B3038_F == B3038_B & Z1004=="AUS_2004"
replace A2037_2 =0 if B3038_F ==. & Z1004=="AUS_2004"
replace A2037_2 =0 if B3038_B ==. & Z1004=="AUS_2004"
*list A2037_2 B3038_D B3038_A if Z1004=="AUS_2004"
*tab A2037_2 if Z1004=="AUS_2004"

replace A2037_3 =1 if B3038_B< B3038_A & Z1004=="AUS_2004"
replace A2037_3 =0 if B3038_B> B3038_A & Z1004=="AUS_2004"
replace A2037_3 =0 if B3038_B == B3038_A & Z1004=="AUS_2004"
replace A2037_3 =0 if B3038_A ==. & Z1004=="AUS_2004"
replace A2037_3 =0 if B3038_B ==. & Z1004=="AUS_2004"
*list A2037_3 B3038_A B3038_B if Z1004=="AUS_2004"
*tab A2037_3 if Z1004=="AUS_2004"

**alost same
replace A2037_4 =0 if B3038_A< B3038_D & Z1004=="AUS_2004"
replace A2037_4 =0 if B3038_A> B3038_D & Z1004=="AUS_2004"
replace A2037_4 =1 if B3038_B == B3038_C & Z1004=="AUS_2004" 
replace A2037_4 =0 if B3038_B & B3038_C==. & Z1004=="AUS_2004"
*list A2037_4 B3038_B B3038_C if Z1004=="AUS_2004" 
*tab A2037_4 if Z1004=="AUS_2004"

***last 
replace A2037_5 =1 if B3038_C< B3038_D & Z1004=="AUS_2004"
replace A2037_5 =0 if B3038_C> B3038_D & Z1004=="AUS_2004"
replace A2037_5 =0 if B3038_C == B3038_D & Z1004=="AUS_2004"
*list A2037_5 B3038_C B3038_D if Z1004=="AUS_2004"
*tab A2037_5 if Z1004=="AUS_2004", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="AUS_2004"
*tab A2037

*)correct placement of parties on the left-right is following the 
*5 parties
replace A2038_1 =1 if B3038_A>5 & Z1004=="AUS_2004"
replace A2038_1 =0 if B3038_A==5 & Z1004=="AUS_2004"
replace A2038_1 =0 if B3038_A<5  & Z1004=="AUS_2004"
replace A2038_1 =0 if B3038_A==.  & Z1004=="AUS_2004"
*tab A2038_1 if Z1004=="AUS_2004"

replace A2038_2 =1 if B3038_B<5 & Z1004=="AUS_2004"
replace A2038_2 =0 if B3038_B==5 & Z1004=="AUS_2004"
replace A2038_2 =0 if B3038_B>5  & Z1004=="AUS_2004"
replace A2038_2 =0 if B3038_B==.  & Z1004=="AUS_2004"
*list A2038_2 B3038_B if Z1004=="AUS_2004"
*tab A2038_2 if Z1004=="AUS_2004"

replace A2038_3 =1 if B3038_C<5 & Z1004=="AUS_2004"
replace A2038_3 =0 if B3038_C==5 & Z1004=="AUS_2004"
replace A2038_3 =0 if B3038_C>5  & Z1004=="AUS_2004"
replace A2038_3 =0 if B3038_C==.  & Z1004=="AUS_2004"
*tab A2038_3 if Z1004=="AUS_2004"
*list B3038_C A2038_3 if Z1004=="AUS_2004"

replace A2038_4 =1 if B3038_D>5 & Z1004=="AUS_2004"
replace A2038_4 =0 if B3038_D==5 & Z1004=="AUS_2004"
replace A2038_4 =0 if B3038_D<5  & Z1004=="AUS_2004"
replace A2038_4 =0 if B3038_D==.  & Z1004=="AUS_2004"
*list B3038_D A2038_4 if Z1004=="AUS_2004"
*tab A2038_4 if Z1004=="AUS_2004"

replace A2038_5 =1 if B3038_F<5 & Z1004=="AUS_2004"
replace A2038_5 =0 if B3038_F==5 & Z1004=="AUS_2004"
replace A2038_5 =0 if B3038_F>5  & Z1004=="AUS_2004"
replace A2038_5 =0 if B3038_F==.  & Z1004=="AUS_2004"
*list B3038_F A2038_5 if Z1004=="AUS_2004"
*tab A2038_5 if Z1004=="AUS_2004"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="AUS_2004"
*tab A2038 if Z1004=="AUS_2004"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="AUS_2004"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="AUS_2004"
*tab  A2039_1 if Z1004=="AUS_2004"
***missings
sum B3038_A if Z1004=="AUS_2004"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="AUS_2004"
replace A2039_1_b= B5018_A-(7.04+2.44) if B3038_A==. & Z1004=="AUS_2004"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="AUS_2004"
*tab  A2039_1_b if Z1004=="AUS_2004"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="AUS_2004"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="AUS_2004"
*tab  A2039_2 if Z1004=="AUS_2004"
***missings
sum B3038_B if Z1004=="AUS_2004"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="AUS_2004"
replace A2039_2_b= B5018_B-(4.31+2.25) if B3038_B==. & Z1004=="AUS_2004"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="AUS_2004"
*tab  A2039_2_b if Z1004=="AUS_2004"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="AUS_2004"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="AUS_2004"
*tab  A2039_3 if Z1004=="AUS_2004"
***missings
sum B3038_C if Z1004=="AUS_2004"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="AUS_2004"
replace A2039_3_b= B5018_C-(3.21+2.47) if B3038_C==. & Z1004=="AUS_2004"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="AUS_2004"
*tab  A2039_3_b if Z1004=="AUS_2004"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="AUS_2004"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="AUS_2004"
*tab  A2039_4 if Z1004=="AUS_2004"
***missings
sum B3038_D if Z1004=="AUS_2004"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="AUS_2004"
replace A2039_4_b= B5018_D-(6.59+2.48) if B3038_D==. & Z1004=="AUS_2004"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="AUS_2004"
*tab  A2039_4_b if Z1004=="AUS_2004"

**Party F
replace A2039_5 = B5018_F-B3038_F if Z1004=="AUS_2004"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="AUS_2004"
*tab  A2039_5 if Z1004=="AUS_2004"
***missings
sum B3038_F if Z1004=="AUS_2004"
replace A2039_5_b = B5018_F-B3038_F if Z1004=="AUS_2004"
replace A2039_5_b= B5018_F-(4.41+2.04) if B3038_F==. & Z1004=="AUS_2004"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="AUS_2004"
*tab  A2039_5_b if Z1004=="AUS_2004"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5)/5 if Z1004=="AUS_2004"
sum  A2039 if Z1004=="AUS_2004"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b)/5 if Z1004=="AUS_2004"
sum  A2039_B if Z1004=="AUS_2004"

****************************************************************************************
*AUS_2007
*tab C5017_A if Z1004=="AUS_2007" 
*tab C5017_B if Z1004=="AUS_2007" 
*tab C5017_C if Z1004=="AUS_2007" 
*tab C5017_D if Z1004=="AUS_2007" 

*tab C3011_A if Z1004=="AUS_2007", mis
*tab C3011_B if Z1004=="AUS_2007", mis
*tab C3011_C if Z1004=="AUS_2007", mis
*tab C3011_D if Z1004=="AUS_2007", mis


mvdecode C3011_A, mv(99), if Z1004=="AUS_2007"
mvdecode C3011_B, mv(99), if Z1004=="AUS_2007"
mvdecode C3011_C, mv(99), if Z1004=="AUS_2007"
mvdecode C3011_D, mv(99), if Z1004=="AUS_2007"
mvdecode C3011_F, mv(99), if Z1004=="AUS_2007"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*4 parties (so 5-4) to most left to most right?
*DABC
replace A2037_1 =1 if C3011_D< C3011_A & Z1004=="AUS_2007"
replace A2037_1 =0 if C3011_D> C3011_A & Z1004=="AUS_2007"
replace A2037_1 =0 if C3011_D == C3011_A & Z1004=="AUS_2007"
replace A2037_1 =0 if C3011_D ==. & Z1004=="AUS_2007"
replace A2037_1 =0 if C3011_A ==. & Z1004=="AUS_2007"
*list A2037_1 C3011_D C3011_A if Z1004=="AUS_2007"
*tab A2037_1 if Z1004=="AUS_2007", miss

replace A2037_2 =1 if C3011_A< C3011_B & Z1004=="AUS_2007"
replace A2037_2 =0 if C3011_A> C3011_B & Z1004=="AUS_2007"
replace A2037_2 =0 if C3011_A == C3011_B & Z1004=="AUS_2007"
replace A2037_2 =0 if C3011_A ==. & Z1004=="AUS_2007"
replace A2037_2 =0 if C3011_B ==. & Z1004=="AUS_2007"
*list A2037_2 C3011_A C3011_B if Z1004=="AUS_2007"
*tab A2037_2 if Z1004=="AUS_2007"

replace A2037_3 =1 if C3011_B< C3011_C & Z1004=="AUS_2007"
replace A2037_3 =0 if C3011_B> C3011_C & Z1004=="AUS_2007"
replace A2037_3 =0 if C3011_B == C3011_C & Z1004=="AUS_2007"
replace A2037_3 =0 if C3011_C ==. & Z1004=="AUS_2007"
replace A2037_3 =0 if C3011_B ==. & Z1004=="AUS_2007"
*list A2037_3 C3011_C C3011_B if Z1004=="AUS_2007"
*tab A2037_3 if Z1004=="AUS_2007"

***last 
replace A2037_5 =1 if C3011_D< C3011_C & Z1004=="AUS_2007"
replace A2037_5 =0 if C3011_D> C3011_C & Z1004=="AUS_2007"
replace A2037_5 =0 if C3011_D == C3011_C & Z1004=="AUS_2007"
*list A2037_5 C3011_C C3011_D if Z1004=="AUS_2007"
*tab A2037_5 if Z1004=="AUS_2007", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_5)/4 if Z1004=="AUS_2007"
*tab A2037

*ii)correct placement of parties on the left-right is following the 
*4 parties
replace A2038_1 =1 if C3011_A<5 & Z1004=="AUS_2007"
replace A2038_1 =0 if C3011_A==5 & Z1004=="AUS_2007"
replace A2038_1 =0 if C3011_A>5  & Z1004=="AUS_2007"
replace A2038_1 =0 if C3011_A==.  & Z1004=="AUS_2007"
*tab A2038_1 if Z1004=="AUS_2007"

replace A2038_2 =1 if C3011_B>5 & Z1004=="AUS_2007"
replace A2038_2 =0 if C3011_B==5 & Z1004=="AUS_2007"
replace A2038_2 =0 if C3011_B<5  & Z1004=="AUS_2007"
replace A2038_2 =0 if C3011_B==.  & Z1004=="AUS_2007"
*list A2038_2 C3011_B if Z1004=="AUS_2007"
*tab A2038_2 if Z1004=="AUS_2007"

replace A2038_3 =1 if C3011_C>5 & Z1004=="AUS_2007"
replace A2038_3 =0 if C3011_C==5 & Z1004=="AUS_2007"
replace A2038_3 =0 if C3011_C<5  & Z1004=="AUS_2007"
replace A2038_3 =0 if C3011_C==.  & Z1004=="AUS_2007"
*tab A2038_3 if Z1004=="AUS_2007"
*list C3011_C A2038_3 if Z1004=="AUS_2007"

replace A2038_4 =1 if C3011_D<5 & Z1004=="AUS_2007"
replace A2038_4 =0 if C3011_D==5 & Z1004=="AUS_2007"
replace A2038_4 =0 if C3011_D>5  & Z1004=="AUS_2007"
replace A2038_4 =0 if C3011_D==.  & Z1004=="AUS_2007"
*list C3011_D A2038_4 if Z1004=="AUS_2007"
*tab A2038_4 if Z1004=="AUS_2007"



*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4)/4 if Z1004=="AUS_2007"
*tab A2038 if Z1004=="AUS_2007"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="AUS_2007"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="AUS_2007"
*tab  A2039_1 if Z1004=="AUS_2007"
***missings
sum C3011_A if Z1004=="AUS_2007"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="AUS_2007"
replace A2039_1_b= C5017_A-(4.35+2.4) if C3011_A==. & Z1004=="AUS_2007"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="AUS_2007"
*tab  A2039_1_b if Z1004=="AUS_2007"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="AUS_2007"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="AUS_2007"
*tab  A2039_2 if Z1004=="AUS_2007"
***missings
sum C3011_B if Z1004=="AUS_2007"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="AUS_2007"
replace A2039_2_b= C5017_B-(6.85+2.62) if C3011_B==. & Z1004=="AUS_2007"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="AUS_2007"
*tab  A2039_2_b if Z1004=="AUS_2007"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="AUS_2007"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="AUS_2007"
*tab  A2039_3 if Z1004=="AUS_2007"
***missings
sum C3011_C if Z1004=="AUS_2007"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="AUS_2007"
replace A2039_3_b= C5017_C-(6.57+2.57) if C3011_C==. & Z1004=="AUS_2007"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="AUS_2007"
*tab  A2039_3_b if Z1004=="AUS_2007"

**Party D
replace A2039_4 = C5017_D-C3011_D if Z1004=="AUS_2007"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="AUS_2007"
*tab  A2039_4 if Z1004=="AUS_2007"
***missings
sum C3011_D if Z1004=="AUS_2007"
replace A2039_4_b = C5017_D-C3011_D if Z1004=="AUS_2007"
replace A2039_4_b= C5017_D-(3.61+2.4) if C3011_D==. & Z1004=="AUS_2007"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="AUS_2007"
*tab  A2039_4_b if Z1004=="AUS_2007"



**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4)/4 if Z1004=="AUS_2007"
sum  A2039 if Z1004=="AUS_2007"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b)/4 if Z1004=="AUS_2007"
sum  A2039_B if Z1004=="AUS_2007"



****************************************************************************************
*AUT_2008

*tab C5017_A if Z1004=="AUT_2008" 
*tab C5017_B if Z1004=="AUT_2008" 
*tab C5017_C if Z1004=="AUT_2008" 
*tab C5017_D if Z1004=="AUT_2008" 
*tab C5017_E if Z1004=="AUT_2008" 
*tab C5017_F if Z1004=="AUT_2008" 
*tab C5017_G if Z1004=="AUT_2008" 

*tab C3011_A if Z1004=="AUT_2008", mis
*tab C3011_B if Z1004=="AUT_2008", mis
*tab C3011_C if Z1004=="AUT_2008", mis
*tab C3011_D if Z1004=="AUT_2008", mis
*tab C3011_E if Z1004=="AUT_2008", mis
*tab C3011_F if Z1004=="AUT_2008", mis
*tab C3011_G if Z1004=="AUT_2008", mis

mvdecode C3011_A, mv(98), if Z1004=="AUT_2008"
mvdecode C3011_B, mv(98), if Z1004=="AUT_2008"
mvdecode C3011_C, mv(98), if Z1004=="AUT_2008"
mvdecode C3011_D, mv(98), if Z1004=="AUT_2008"
mvdecode C3011_F, mv(98), if Z1004=="AUT_2008"
mvdecode C3011_G, mv(98), if Z1004=="AUT_2008"
mvdecode C3011_E, mv(98), if Z1004=="AUT_2008"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*7 parties 
*E A F G B D C
replace A2037_1 =1 if C3011_E< C3011_A & Z1004=="AUT_2008"
replace A2037_1 =0 if C3011_E> C3011_A & Z1004=="AUT_2008"
replace A2037_1 =0 if C3011_E == C3011_A & Z1004=="AUT_2008"
replace A2037_1 =0 if C3011_E ==. & Z1004=="AUT_2008"
replace A2037_1 =0 if C3011_A ==. & Z1004=="AUT_2008"
*list A2037_1 C3011_E C3011_A if Z1004=="AUT_2008"
*tab A2037_1 if Z1004=="AUT_2008", miss

replace A2037_2 =1 if C3011_A< C3011_F & Z1004=="AUT_2008"
replace A2037_2 =0 if C3011_A> C3011_F & Z1004=="AUT_2008"
replace A2037_2 =0 if C3011_A == C3011_F & Z1004=="AUT_2008"
replace A2037_2 =0 if C3011_A ==. & Z1004=="AUT_2008"
replace A2037_2 =0 if C3011_F ==. & Z1004=="AUT_2008"
*list A2037_2 C3011_A C3011_F if Z1004=="AUT_2008"
*tab A2037_2 if Z1004=="AUT_2008"

replace A2037_3 =1 if C3011_F< C3011_G & Z1004=="AUT_2008"
replace A2037_3 =0 if C3011_F> C3011_G & Z1004=="AUT_2008"
replace A2037_3 =0 if C3011_F == C3011_G & Z1004=="AUT_2008"
replace A2037_3 =0 if C3011_G ==. & Z1004=="AUT_2008"
replace A2037_3 =0 if C3011_F ==. & Z1004=="AUT_2008"
*list A2037_3 C3011_F C3011_G if Z1004=="AUT_2008"
*tab A2037_3 if Z1004=="AUT_2008"

replace A2037_4 =1 if C3011_G< C3011_B & Z1004=="AUT_2008"
replace A2037_4 =0 if C3011_G> C3011_B & Z1004=="AUT_2008"
replace A2037_4 =0 if C3011_G == C3011_B & Z1004=="AUT_2008"
replace A2037_4 =0 if C3011_G ==. & Z1004=="AUT_2008"
replace A2037_4 =0 if C3011_B ==. & Z1004=="AUT_2008"
*list A2037_4 C3011_F C3011_G if Z1004=="AUT_2008"
*tab A2037_4 if Z1004=="AUT_2008"

replace A2037_5 =1 if C3011_B< C3011_D & Z1004=="AUT_2008"
replace A2037_5 =0 if C3011_B> C3011_D & Z1004=="AUT_2008"
replace A2037_5 =0 if C3011_B == C3011_D & Z1004=="AUT_2008"
replace A2037_5 =0 if C3011_B ==. & Z1004=="AUT_2008"
replace A2037_5 =0 if C3011_D ==. & Z1004=="AUT_2008"
*list A2037_5 C3011_C C3011_G if Z1004=="AUT_2008"
*tab A2037_5 if Z1004=="AUT_2008", missing

replace A2037_6 =1 if C3011_D< C3011_C & Z1004=="AUT_2008"
replace A2037_6 =0 if C3011_D> C3011_C & Z1004=="AUT_2008"
replace A2037_6 =0 if C3011_D == C3011_C & Z1004=="AUT_2008"
replace A2037_6 =0 if C3011_D ==. & Z1004=="AUT_2008"
replace A2037_6 =0 if C3011_C ==. & Z1004=="AUT_2008"
*list A2037_6 C3011_C C3011_G if Z1004=="AUT_2008"
*tab A2037_6 if Z1004=="AUT_2008", missing

replace A2037_7 =1 if C3011_E< C3011_C & Z1004=="AUT_2008"
replace A2037_7 =0 if C3011_E> C3011_C & Z1004=="AUT_2008"
replace A2037_7 =0 if C3011_E == C3011_C & Z1004=="AUT_2008"
replace A2037_7 =0 if C3011_E ==. & Z1004=="AUT_2008"
replace A2037_7 =0 if C3011_C ==. & Z1004=="AUT_2008"
*list A2037_7 C3011_C C3011_G if Z1004=="AUT_2008"
*tab A2037_7 if Z1004=="AUT_2008", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7)/7 if Z1004=="AUT_2008"
*tab A2037 if Z1004=="AUT_2008"

*ii)correct placement of parties on the left-right is following the 
*4 parties
replace A2038_1 =1 if C3011_A<5 & Z1004=="AUT_2008"
replace A2038_1 =0 if C3011_A==5 & Z1004=="AUT_2008"
replace A2038_1 =0 if C3011_A>5  & Z1004=="AUT_2008"
replace A2038_1 =0 if C3011_A==.  & Z1004=="AUT_2008"
*tab A2038_1 if Z1004=="AUT_2008"

replace A2038_2 =1 if C3011_B>5 & Z1004=="AUT_2008"
replace A2038_2 =0 if C3011_B==5 & Z1004=="AUT_2008"
replace A2038_2 =0 if C3011_B<5  & Z1004=="AUT_2008"
replace A2038_2 =0 if C3011_B==.  & Z1004=="AUT_2008"
*list A2038_2 C3011_B if Z1004=="AUT_2008"
*tab A2038_2 if Z1004=="AUT_2008"

replace A2038_3 =1 if C3011_C>5 & Z1004=="AUT_2008"
replace A2038_3 =0 if C3011_C==5 & Z1004=="AUT_2008"
replace A2038_3 =0 if C3011_C<5  & Z1004=="AUT_2008"
replace A2038_3 =0 if C3011_C==.  & Z1004=="AUT_2008"
*tab A2038_3 if Z1004=="AUT_2008"
*list C3011_C A2038_3 if Z1004=="AUT_2008"

replace A2038_4 =1 if C3011_D>5 & Z1004=="AUT_2008"
replace A2038_4 =0 if C3011_D==5 & Z1004=="AUT_2008"
replace A2038_4 =0 if C3011_D<5  & Z1004=="AUT_2008"
replace A2038_4 =0 if C3011_D==.  & Z1004=="AUT_2008"
*list C3011_D A2038_4 if Z1004=="AUT_2008"
*tab A2038_4 if Z1004=="AUT_2008"

replace A2038_5 =0 if C3011_F<5 & Z1004=="AUT_2008"
replace A2038_5 =1 if C3011_F==5 & Z1004=="AUT_2008"
replace A2038_5 =0 if C3011_F>5  & Z1004=="AUT_2008"
replace A2038_5 =0 if C3011_F==.  & Z1004=="AUT_2008"
*list C3011_F A2038_5 if Z1004=="AUT_2008"
*tab A2038_5 if Z1004=="AUT_2008"

replace A2038_6 =1 if C3011_E<5 & Z1004=="AUT_2008"
replace A2038_6 =0 if C3011_E==5 & Z1004=="AUT_2008"
replace A2038_6 =0 if C3011_E>5  & Z1004=="AUT_2008"
replace A2038_6 =0 if C3011_E==.  & Z1004=="AUT_2008"
*list C3011_E A2038_5 if Z1004=="AUT_2008"
*tab A2038_6 if Z1004=="AUT_2008"

replace A2038_7 =1 if C3011_G>5 & Z1004=="AUT_2008"
replace A2038_7 =0 if C3011_G==5 & Z1004=="AUT_2008"
replace A2038_7 =0 if C3011_G<5  & Z1004=="AUT_2008"
replace A2038_7 =0 if C3011_G==.  & Z1004=="AUT_2008"
*list C3011_G A2038_5 if Z1004=="AUT_2008"
*tab A2038_7 if Z1004=="AUT_2008"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7)/7 if Z1004=="AUT_2008"
*tab A2038 if Z1004=="AUT_2008"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="AUT_2008"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="AUT_2008"
*tab  A2039_1 if Z1004=="AUT_2008"
***missings
sum C3011_A if Z1004=="AUT_2008"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="AUT_2008"
replace A2039_1_b= C5017_A-(3.02+2.11) if C3011_A==. & Z1004=="AUT_2008"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="AUT_2008"
*tab  A2039_1_b if Z1004=="AUT_2008"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="AUT_2008"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="AUT_2008"
*tab  A2039_2 if Z1004=="AUT_2008"
***missings
sum C3011_B if Z1004=="AUT_2008"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="AUT_2008"
replace A2039_2_b= C5017_B-(5.72+2.06) if C3011_B==. & Z1004=="AUT_2008"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="AUT_2008"
*tab  A2039_2_b if Z1004=="AUT_2008"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="AUT_2008"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="AUT_2008"
*tab  A2039_3 if Z1004=="AUT_2008"
***missings
sum C3011_C if Z1004=="AUT_2008"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="AUT_2008"
replace A2039_3_b= C5017_C-(7.91+2.77) if C3011_C==. & Z1004=="AUT_2008"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="AUT_2008"
*tab  A2039_3_b if Z1004=="AUT_2008"

**Party D
replace A2039_4 = C5017_D-C3011_D if Z1004=="AUT_2008"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="AUT_2008"
*tab  A2039_4 if Z1004=="AUT_2008"
***missings
sum C3011_D if Z1004=="AUT_2008"
replace A2039_4_b = C5017_D-C3011_D if Z1004=="AUT_2008"
replace A2039_4_b= C5017_D-(7.28+2.77) if C3011_D==. & Z1004=="AUT_2008"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="AUT_2008"
*tab  A2039_4_b if Z1004=="AUT_2008"

**Party F
replace A2039_5 = C5017_F-C3011_F if Z1004=="AUT_2008"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="AUT_2008"
*tab  A2039_5 if Z1004=="AUT_2008"
***missings
sum C3011_F if Z1004=="AUT_2008"
replace A2039_5_b = C5017_F-C3011_F if Z1004=="AUT_2008"
replace A2039_5_b= C5017_F-(4.20+2.5) if C3011_F==. & Z1004=="AUT_2008"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="AUT_2008"
*tab  A2039_5_b if Z1004=="AUT_2008"

**Party E
replace A2039_6 = C5017_E-C3011_E if Z1004=="AUT_2008"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="AUT_2008"
*tab  A2039_6 if Z1004=="AUT_2008"
***missings
sum C3011_E if Z1004=="AUT_2008"
replace A2039_6_b = C5017_E-C3011_E if Z1004=="AUT_2008"
replace A2039_6_b= C5017_E-(2.61+2.17) if C3011_E==. & Z1004=="AUT_2008"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="AUT_2008"
*tab  A2039_6_b if Z1004=="AUT_2008"

**Party G
replace A2039_7 = C5017_G-C3011_G if Z1004=="AUT_2008"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="AUT_2008"
*tab  A2039_7 if Z1004=="AUT_2008"
***missings
sum C3011_G if Z1004=="AUT_2008"
replace A2039_7_b = C5017_G-C3011_G if Z1004=="AUT_2008"
replace A2039_7_b= C5017_G-(4.88+2.38) if C3011_G==. & Z1004=="AUT_2008"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="AUT_2008"
*tab  A2039_7_b if Z1004=="AUT_2008"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7)/7 if Z1004=="AUT_2008"
sum  A2039 if Z1004=="AUT_2008"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b)/7 if Z1004=="AUT_2008"
sum  A2039_B if Z1004=="AUT_2008"


****************************************************************************************
*AUT_2013

*tab D5017_A if Z1004=="AUT_2013" 
*tab D5017_B if Z1004=="AUT_2013" 
*tab D5017_C if Z1004=="AUT_2013" 
*tab D5017_D if Z1004=="AUT_2013" 
*tab D5017_E if Z1004=="AUT_2013" 
*tab D5017_F if Z1004=="AUT_2013" 
*tab D5017_G if Z1004=="AUT_2013" 
*tab D5017_H if Z1004=="AUT_2013"  

*tab D3013_A if Z1004=="AUT_2013", mis
*tab D3013_B if Z1004=="AUT_2013", mis
*tab D3013_C if Z1004=="AUT_2013", mis
*tab D3013_D if Z1004=="AUT_2013", mis
*tab D3013_E if Z1004=="AUT_2013", mis
*tab D3013_F if Z1004=="AUT_2013", mis
*tab D3013_G if Z1004=="AUT_2013", mis
*tab D3013_H if Z1004=="AUT_2013", mis

mvdecode D3013_A, mv(96, 97, 98), if Z1004=="AUT_2013"
mvdecode D3013_B, mv(96, 97, 98), if Z1004=="AUT_2013"
mvdecode D3013_C, mv(96, 97, 98), if Z1004=="AUT_2013"
mvdecode D3013_D, mv(96, 97, 98), if Z1004=="AUT_2013"
mvdecode D3013_F, mv(96, 97, 98), if Z1004=="AUT_2013"
mvdecode D3013_G, mv(96, 97, 98), if Z1004=="AUT_2013"
mvdecode D3013_E, mv(96, 97, 98), if Z1004=="AUT_2013"
mvdecode D3013_H, mv(96, 97, 98), if Z1004=="AUT_2013"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*7 parties 
*D A B F E G C
replace A2037_1 =1 if D3013_D< D3013_A & Z1004=="AUT_2013"
replace A2037_1 =0 if D3013_D> D3013_A & Z1004=="AUT_2013"
replace A2037_1 =0 if D3013_D == D3013_A & Z1004=="AUT_2013"
replace A2037_1 =0 if D3013_D ==. & Z1004=="AUT_2013"
replace A2037_1 =0 if D3013_A ==. & Z1004=="AUT_2013"
*list A2037_1 D3013_H D3013_G if Z1004=="AUT_2013"
*tab A2037_1 if Z1004=="AUT_2013", miss

replace A2037_2 =1 if D3013_A< D3013_B & Z1004=="AUT_2013"
replace A2037_2 =0 if D3013_A> D3013_B & Z1004=="AUT_2013"
replace A2037_2 =0 if D3013_A == D3013_B & Z1004=="AUT_2013"
replace A2037_2 =0 if D3013_A ==. & Z1004=="AUT_2013"
replace A2037_2 =0 if D3013_B ==. & Z1004=="AUT_2013"
*list A2037_2 D3013_A D3013_B if Z1004=="AUT_2013"
*tab A2037_2 if Z1004=="AUT_2013"

replace A2037_3 =0 if D3013_F< D3013_B & Z1004=="AUT_2013"
replace A2037_3 =0 if D3013_F> D3013_B & Z1004=="AUT_2013"
replace A2037_3 =1 if D3013_F == D3013_B & Z1004=="AUT_2013"
replace A2037_3 =0 if D3013_B ==. & Z1004=="AUT_2013"
replace A2037_3 =0 if D3013_F ==. & Z1004=="AUT_2013"
*list A2037_3 D3013_F D3013_B if Z1004=="AUT_2013"
*tab A2037_3 if Z1004=="AUT_2013"

replace A2037_4 =1 if D3013_F< D3013_E & Z1004=="AUT_2013"
replace A2037_4 =0 if D3013_F> D3013_E & Z1004=="AUT_2013"
replace A2037_4 =0 if D3013_F == D3013_E & Z1004=="AUT_2013"
replace A2037_4 =0 if D3013_F ==. & Z1004=="AUT_2013"
replace A2037_4 =0 if D3013_E ==. & Z1004=="AUT_2013"
*list A2037_4 D3013_F D3013_E if Z1004=="AUT_2013"
*tab A2037_4 if Z1004=="AUT_2013"

replace A2037_5 =0 if D3013_F< D3013_G & Z1004=="AUT_2013"
replace A2037_5 =0 if D3013_F> D3013_G & Z1004=="AUT_2013"
replace A2037_5 =1 if D3013_F == D3013_G & Z1004=="AUT_2013"
replace A2037_5 =0 if D3013_F ==. & Z1004=="AUT_2013"
replace A2037_5 =0 if D3013_G ==. & Z1004=="AUT_2013"
*list A2037_5 D3013_C D3013_G if Z1004=="AUT_2013"
*tab A2037_5 if Z1004=="AUT_2013", missing

replace A2037_6 =1 if D3013_G< D3013_C & Z1004=="AUT_2013"
replace A2037_6 =0 if D3013_G> D3013_C & Z1004=="AUT_2013"
replace A2037_6 =0 if D3013_G == D3013_C & Z1004=="AUT_2013"
replace A2037_6 =0 if D3013_G ==. & Z1004=="AUT_2013"
replace A2037_6 =0 if D3013_C ==. & Z1004=="AUT_2013"
*list A2037_6 D3013_C D3013_G if Z1004=="AUT_2013"
*tab A2037_6 if Z1004=="AUT_2013", missing

replace A2037_7 =1 if D3013_D< D3013_C & Z1004=="AUT_2013"
replace A2037_7 =0 if D3013_D> D3013_C & Z1004=="AUT_2013"
replace A2037_7 =0 if D3013_D == D3013_C & Z1004=="AUT_2013"
replace A2037_7 =0 if D3013_D ==. & Z1004=="AUT_2013"
replace A2037_7 =0 if D3013_C ==. & Z1004=="AUT_2013"
*list A2037_7 D3013_C D3013_G if Z1004=="AUT_2013"
*tab A2037_7 if Z1004=="AUT_2013", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7)/7 if Z1004=="AUT_2013"
*tab A2037 if Z1004=="AUT_2013"

*ii)correct placement of parties on the left-right is following the 
*7 parties
replace A2038_1 =1 if D3013_A<5 & Z1004=="AUT_2013"
replace A2038_1 =0 if D3013_A==5 & Z1004=="AUT_2013"
replace A2038_1 =0 if D3013_A>5  & Z1004=="AUT_2013"
replace A2038_1 =0 if D3013_A==.  & Z1004=="AUT_2013"
*tab A2038_1 if Z1004=="AUT_2013"

replace A2038_2 =1 if D3013_B>5 & Z1004=="AUT_2013"
replace A2038_2 =0 if D3013_B==5 & Z1004=="AUT_2013"
replace A2038_2 =0 if D3013_B<5  & Z1004=="AUT_2013"
replace A2038_2 =0 if D3013_B==.  & Z1004=="AUT_2013"
*list A2038_2 D3013_B if Z1004=="AUT_2013"
*tab A2038_2 if Z1004=="AUT_2013"

replace A2038_3 =1 if D3013_C>5 & Z1004=="AUT_2013"
replace A2038_3 =0 if D3013_C==5 & Z1004=="AUT_2013"
replace A2038_3 =0 if D3013_C<5  & Z1004=="AUT_2013"
replace A2038_3 =0 if D3013_C==.  & Z1004=="AUT_2013"
*tab A2038_3 if Z1004=="AUT_2013"
*list D3013_C A2038_3 if Z1004=="AUT_2013"

replace A2038_4 =1 if D3013_D<5 & Z1004=="AUT_2013"
replace A2038_4 =0 if D3013_D==5 & Z1004=="AUT_2013"
replace A2038_4 =0 if D3013_D>5  & Z1004=="AUT_2013"
replace A2038_4 =0 if D3013_D==.  & Z1004=="AUT_2013"
*list D3013_D A2038_4 if Z1004=="AUT_2013"
*tab A2038_4 if Z1004=="AUT_2013"

replace A2038_5 =1 if D3013_F>5 & Z1004=="AUT_2013"
replace A2038_5 =0 if D3013_F==5 & Z1004=="AUT_2013"
replace A2038_5 =0 if D3013_F<5  & Z1004=="AUT_2013"
replace A2038_5 =0 if D3013_F==.  & Z1004=="AUT_2013"
*list D3013_F A2038_5 if Z1004=="AUT_2013"
*tab A2038_5 if Z1004=="AUT_2013"

replace A2038_6 =1 if D3013_E>5 & Z1004=="AUT_2013"
replace A2038_6 =0 if D3013_E==5 & Z1004=="AUT_2013"
replace A2038_6 =0 if D3013_E<5  & Z1004=="AUT_2013"
replace A2038_6 =0 if D3013_E==.  & Z1004=="AUT_2013"
*list D3013_E A2038_5 if Z1004=="AUT_2013"
*tab A2038_6 if Z1004=="AUT_2013"

replace A2038_7 =1 if D3013_G>5 & Z1004=="AUT_2013"
replace A2038_7 =0 if D3013_G==5 & Z1004=="AUT_2013"
replace A2038_7 =0 if D3013_G<5  & Z1004=="AUT_2013"
replace A2038_7 =0 if D3013_G==.  & Z1004=="AUT_2013"
*list D3013_G A2038_5 if Z1004=="AUT_2013"
*tab A2038_7 if Z1004=="AUT_2013"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7)/7 if Z1004=="AUT_2013"
*tab A2038 if Z1004=="AUT_2013"

**version iii
**Party A
replace A2039_1 = D5017_A-D3013_A if Z1004=="AUT_2013"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="AUT_2013"
*tab  A2039_1 if Z1004=="AUT_2013"
***missings
sum D3013_A if Z1004=="AUT_2013"
replace A2039_1_b = D5017_A-D3013_A if Z1004=="AUT_2013"
replace A2039_1_b= D5017_A-(3.87+2.16) if D3013_A==. & Z1004=="AUT_2013"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="AUT_2013"
*tab  A2039_1_b if Z1004=="AUT_2013"

**Party B
replace A2039_2 = D5017_B-D3013_B if Z1004=="AUT_2013"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="AUT_2013"
*tab  A2039_2 if Z1004=="AUT_2013"
***missings
sum D3013_B if Z1004=="AUT_2013"
replace A2039_2_b = D5017_B-D3013_B if Z1004=="AUT_2013"
replace A2039_2_b= D5017_B-(5.67+2.17) if D3013_B==. & Z1004=="AUT_2013"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="AUT_2013"
*tab  A2039_2_b if Z1004=="AUT_2013"

**Party C
replace A2039_3 = D5017_C-D3013_C if Z1004=="AUT_2013"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="AUT_2013"
*tab  A2039_3 if Z1004=="AUT_2013"
***missings
sum D3013_C if Z1004=="AUT_2013"
replace A2039_3_b = D5017_C-D3013_C if Z1004=="AUT_2013"
replace A2039_3_b= D5017_C-(7.41+2.81) if D3013_C==. & Z1004=="AUT_2013"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="AUT_2013"
*tab  A2039_3_b if Z1004=="AUT_2013"

**Party D
replace A2039_4 = D5017_D-D3013_D if Z1004=="AUT_2013"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="AUT_2013"
*tab  A2039_4 if Z1004=="AUT_2013"
***missings
sum D3013_D if Z1004=="AUT_2013"
replace A2039_4_b = D5017_D-D3013_D if Z1004=="AUT_2013"
replace A2039_4_b= D5017_D-(3.21+2.11) if D3013_D==. & Z1004=="AUT_2013"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="AUT_2013"
*tab  A2039_4_b if Z1004=="AUT_2013"

**Party F
replace A2039_5 = D5017_F-D3013_F if Z1004=="AUT_2013"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="AUT_2013"
*tab  A2039_5 if Z1004=="AUT_2013"
***missings
sum D3013_F if Z1004=="AUT_2013"
replace A2039_5_b = D5017_F-D3013_F if Z1004=="AUT_2013"
replace A2039_5_b= D5017_F-(4.40+2.14) if D3013_F==. & Z1004=="AUT_2013"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="AUT_2013"
*tab  A2039_5_b if Z1004=="AUT_2013"

**Party E
replace A2039_6 = D5017_E-D3013_E if Z1004=="AUT_2013"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="AUT_2013"
*tab  A2039_6 if Z1004=="AUT_2013"
***missings
sum D3013_E if Z1004=="AUT_2013"
replace A2039_6_b = D5017_E-D3013_E if Z1004=="AUT_2013"
replace A2039_6_b= D5017_E-(5.22+2.72) if D3013_E==. & Z1004=="AUT_2013"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="AUT_2013"
*tab  A2039_6_b if Z1004=="AUT_2013"

**Party G
replace A2039_7 = D5017_G-D3013_G if Z1004=="AUT_2013"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="AUT_2013"
*tab  A2039_7 if Z1004=="AUT_2013"
***missings
sum D3013_G if Z1004=="AUT_2013"
replace A2039_7_b = D5017_G-D3013_G if Z1004=="AUT_2013"
replace A2039_7_b= D5017_G-(6.15+2.59) if D3013_G==. & Z1004=="AUT_2013"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="AUT_2013"
*tab  A2039_7_b if Z1004=="AUT_2013"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7)/7 if Z1004=="AUT_2013"
sum A2039 if Z1004=="AUT_2013"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b)/7 if Z1004=="AUT_2013"
sum  A2039_B if Z1004=="AUT_2013"


****************************************************************************************
*BRA_2002 
***mess in there, most parties have the same average, whatever that means.
*tab B5018_A if Z1004=="BRA_2002" 
*tab B5018_B if Z1004=="BRA_2002" 
*tab B5018_C if Z1004=="BRA_2002" 
*tab B5018_D if Z1004=="BRA_2002" 
*tab B5018_G if Z1004=="BRA_2002" 


sum B3038_A if Z1004=="BRA_2002"
sum B3038_B if Z1004=="BRA_2002"
sum B3038_C if Z1004=="BRA_2002"
sum B3038_D if Z1004=="BRA_2002"
sum B3038_G if Z1004=="BRA_2002"


mvdecode B3038_A, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2002"
mvdecode B3038_B, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2002"
mvdecode B3038_C, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2002"
mvdecode B3038_D, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2002"
mvdecode B3038_E, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2002"
mvdecode B3038_G, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2002"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*5 parties (so 5-4) to most left to most right?
*A G B D C (a = g)
replace A2037_1 =0 if B3038_A< B3038_G & Z1004=="BRA_2002"
replace A2037_1 =0 if B3038_A> B3038_G & Z1004=="BRA_2002"
replace A2037_1 =1 if B3038_A == B3038_G & Z1004=="BRA_2002"
replace A2037_1 =0 if B3038_A ==. & Z1004=="BRA_2002"
replace A2037_1 =0 if B3038_G ==. & Z1004=="BRA_2002"
*list A2037_1 B3038_D B3038_E if Z1004=="BRA_2002"
*tab A2037_1 if Z1004=="BRA_2002", miss

replace A2037_2 =1 if B3038_G< B3038_B & Z1004=="BRA_2002"
replace A2037_2 =0 if B3038_G> B3038_B & Z1004=="BRA_2002"
replace A2037_2 =0 if B3038_G == B3038_B & Z1004=="BRA_2002"
replace A2037_2 =0 if B3038_G ==. & Z1004=="BRA_2002"
replace A2037_2 =0 if B3038_B ==. & Z1004=="BRA_2002"
*list A2037_2 B3038_G B3038_B if Z1004=="BRA_2002"
*tab A2037_2 if Z1004=="BRA_2002"

replace A2037_3 =1 if B3038_B< B3038_D & Z1004=="BRA_2002"
replace A2037_3 =0 if B3038_B> B3038_D & Z1004=="BRA_2002"
replace A2037_3 =0 if B3038_B == B3038_D & Z1004=="BRA_2002"
replace A2037_3 =0 if B3038_D ==. & Z1004=="BRA_2002"
replace A2037_3 =0 if B3038_B ==. & Z1004=="BRA_2002"
*list A2037_3 B3038_D B3038_B if Z1004=="BRA_2002"
*tab A2037_3 if Z1004=="BRA_2002"

replace A2037_4 =1 if B3038_D< B3038_C & Z1004=="BRA_2002"
replace A2037_4 =0 if B3038_D> B3038_C & Z1004=="BRA_2002"
replace A2037_4 =0 if B3038_D == B3038_C & Z1004=="BRA_2002" 
replace A2037_4 =0 if B3038_C & B3038_D==. & Z1004=="BRA_2002"
*list A2037_4 B3038_B B3038_C if Z1004=="BRA_2002" 
*tab A2037_4 if Z1004=="BRA_2002"

***last 
replace A2037_5 =1 if B3038_A< B3038_C & Z1004=="BRA_2002"
replace A2037_5 =0 if B3038_A> B3038_C & Z1004=="BRA_2002"
replace A2037_5 =0 if B3038_A == B3038_C & Z1004=="BRA_2002"
replace A2037_5 =0 if B3038_A ==. & Z1004=="BRA_2002"
replace A2037_5 =0 if B3038_C ==. & Z1004=="BRA_2002"
*list A2037_5 B3038_C B3038_A if Z1004=="BRA_2002"
*tab A2037_5 if Z1004=="BRA_2002", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="BRA_2002"
*tab A2037 if Z1004=="BRA_2002"

*)correct placement of parties on the left-right is following the 
*5 parties
replace A2038_1 =1 if B3038_A<5 & Z1004=="BRA_2002"
replace A2038_1 =0 if B3038_A==5 & Z1004=="BRA_2002"
replace A2038_1 =0 if B3038_A>5  & Z1004=="BRA_2002"
replace A2038_1 =0 if B3038_A==.  & Z1004=="BRA_2002"
*tab A2038_1 if Z1004=="BRA_2002"

replace A2038_2 =1 if B3038_B<5 & Z1004=="BRA_2002"
replace A2038_2 =0 if B3038_B==5 & Z1004=="BRA_2002"
replace A2038_2 =0 if B3038_B>5  & Z1004=="BRA_2002"
replace A2038_2 =0 if B3038_B==.  & Z1004=="BRA_2002"
*list A2038_2 B3038_B if Z1004=="BRA_2002"
*tab A2038_2 if Z1004=="BRA_2002"

replace A2038_3 =1 if B3038_C>5 & Z1004=="BRA_2002"
replace A2038_3 =0 if B3038_C==5 & Z1004=="BRA_2002"
replace A2038_3 =0 if B3038_C<5  & Z1004=="BRA_2002"
replace A2038_3 =0 if B3038_C==.  & Z1004=="BRA_2002"
*tab A2038_3 if Z1004=="BRA_2002"
*list B3038_C A2038_3 if Z1004=="BRA_2002"

replace A2038_4 =0 if B3038_D>5 & Z1004=="BRA_2002"
replace A2038_4 =1 if B3038_D==5 & Z1004=="BRA_2002"
replace A2038_4 =0 if B3038_D<5  & Z1004=="BRA_2002"
replace A2038_4 =0 if B3038_D==.  & Z1004=="BRA_2002"
*list B3038_D A2038_4 if Z1004=="BRA_2002"
*tab A2038_4 if Z1004=="BRA_2002"

replace A2038_5 =1 if B3038_G<5 & Z1004=="BRA_2002"
replace A2038_5 =0 if B3038_G==5 & Z1004=="BRA_2002"
replace A2038_5 =0 if B3038_G>5  & Z1004=="BRA_2002"
replace A2038_5 =0 if B3038_G==.  & Z1004=="BRA_2002"
*list B3038_F A2038_5 if Z1004=="BRA_2002"
*tab A2038_5 if Z1004=="BRA_2002"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="BRA_2002"
*tab A2038 if Z1004=="BRA_2002"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="BRA_2002"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="BRA_2002"
*tab  A2039_1 if Z1004=="BRA_2002"
***missings
sum B3038_A if Z1004=="BRA_2002"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="BRA_2002"
replace A2039_1_b= B5018_A-(3.7+3.46) if B3038_A==. & Z1004=="BRA_2002"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="BRA_2002"
*tab  A2039_1_b if Z1004=="BRA_2002"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="BRA_2002"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="BRA_2002"
*tab  A2039_2 if Z1004=="BRA_2002"
***missings
sum B3038_B if Z1004=="BRA_2002"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="BRA_2002"
replace A2039_2_b= B5018_B-(6.15+3.09) if B3038_B==. & Z1004=="BRA_2002"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="BRA_2002"
*tab  A2039_2_b if Z1004=="BRA_2002"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="BRA_2002"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="BRA_2002"
*tab  A2039_3 if Z1004=="BRA_2002"
***missings
sum B3038_C if Z1004=="BRA_2002"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="BRA_2002"
replace A2039_3_b= B5018_C-(6.00+3.15) if B3038_C==. & Z1004=="BRA_2002"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="BRA_2002"
*tab  A2039_3_b if Z1004=="BRA_2002"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="BRA_2002"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="BRA_2002"
*tab  A2039_4 if Z1004=="BRA_2002"
***missings
sum B3038_D if Z1004=="BRA_2002"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="BRA_2002"
replace A2039_4_b= B5018_D-(6.08+3.13) if B3038_D==. & Z1004=="BRA_2002"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="BRA_2002"
*tab  A2039_4_b if Z1004=="BRA_2002"

**Party G
replace A2039_5 = B5018_G-B3038_G if Z1004=="BRA_2002"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="BRA_2002"
*tab  A2039_5 if Z1004=="BRA_2002"
***missings
sum B3038_G if Z1004=="BRA_2002"
replace A2039_5_b = B5018_G-B3038_G if Z1004=="BRA_2002"
replace A2039_5_b= B5018_G-(6.15+3.1) if B3038_G==. & Z1004=="BRA_2002"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="BRA_2002"
*tab  A2039_5_b if Z1004=="BRA_2002"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5)/5 if Z1004=="BRA_2002"
sum  A2039 if Z1004=="BRA_2002"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b)/5 if Z1004=="BRA_2002"
sum  A2039_B if Z1004=="BRA_2002"


****************************************************************************************
*BRA_2006

*tab C5017_A if Z1004=="BRA_2006" 
*tab C5017_B if Z1004=="BRA_2006" 
*tab C5017_C if Z1004=="BRA_2006" 
*tab C5017_D if Z1004=="BRA_2006" 
*tab C5017_E if Z1004=="BRA_2006" 
*tab C5017_F if Z1004=="BRA_2006" 

*tab C3011_A if Z1004=="BRA_2006", mis
*tab C3011_B if Z1004=="BRA_2006", mis
*tab C3011_C if Z1004=="BRA_2006", mis
*tab C3011_D if Z1004=="BRA_2006", mis
*tab C3011_E if Z1004=="BRA_2006", mis
*tab C3011_F if Z1004=="BRA_2006", mis

mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2006"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2006"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2006"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2006"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2006"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2006"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*6 parties 
*B E C A F D
replace A2037_1 =1 if C3011_B< C3011_E & Z1004=="BRA_2006"
replace A2037_1 =0 if C3011_B> C3011_E & Z1004=="BRA_2006"
replace A2037_1 =0 if C3011_B == C3011_E & Z1004=="BRA_2006"
replace A2037_1 =0 if C3011_B ==. & Z1004=="BRA_2006"
replace A2037_1 =0 if C3011_E ==. & Z1004=="BRA_2006"
*list A2037_1 C3011_B C3011_E if Z1004=="BRA_2006"
*tab A2037_1 if Z1004=="BRA_2006", miss

replace A2037_2 =1 if C3011_E< C3011_C & Z1004=="BRA_2006"
replace A2037_2 =0 if C3011_E> C3011_C & Z1004=="BRA_2006"
replace A2037_2 =0 if C3011_E == C3011_C & Z1004=="BRA_2006"
replace A2037_2 =0 if C3011_E ==. & Z1004=="BRA_2006"
replace A2037_2 =0 if C3011_C ==. & Z1004=="BRA_2006"
*list A2037_2 C3011_E C3011_C if Z1004=="BRA_2006"
*tab A2037_2 if Z1004=="BRA_2006"

replace A2037_3 =1 if C3011_C< C3011_A & Z1004=="BRA_2006"
replace A2037_3 =0 if C3011_C> C3011_A & Z1004=="BRA_2006"
replace A2037_3 =0 if C3011_C == C3011_A & Z1004=="BRA_2006"
replace A2037_3 =0 if C3011_C ==. & Z1004=="BRA_2006"
replace A2037_3 =0 if C3011_A ==. & Z1004=="BRA_2006"
*list A2037_3 C3011_F C3011_G if Z1004=="BRA_2006"
*tab A2037_3 if Z1004=="BRA_2006"

replace A2037_4 =0 if C3011_A< C3011_F & Z1004=="BRA_2006"
replace A2037_4 =0 if C3011_A> C3011_F & Z1004=="BRA_2006"
replace A2037_4 =1 if C3011_A == C3011_F & Z1004=="BRA_2006"
replace A2037_4 =0 if C3011_A ==. & Z1004=="BRA_2006"
replace A2037_4 =0 if C3011_F ==. & Z1004=="BRA_2006"
*list A2037_4 C3011_F C3011_A if Z1004=="BRA_2006"
*tab A2037_4 if Z1004=="BRA_2006"

replace A2037_5 =1 if C3011_F< C3011_D & Z1004=="BRA_2006"
replace A2037_5 =0 if C3011_F> C3011_D & Z1004=="BRA_2006"
replace A2037_5 =0 if C3011_F == C3011_D & Z1004=="BRA_2006"
replace A2037_5 =0 if C3011_F ==. & Z1004=="BRA_2006"
replace A2037_5 =0 if C3011_D ==. & Z1004=="BRA_2006"
*list A2037_5 C3011_F C3011_D if Z1004=="BRA_2006"
*tab A2037_5 if Z1004=="BRA_2006", missing

replace A2037_6 =1 if C3011_B< C3011_D & Z1004=="BRA_2006"
replace A2037_6 =0 if C3011_B> C3011_D & Z1004=="BRA_2006"
replace A2037_6 =0 if C3011_B == C3011_D & Z1004=="BRA_2006"
replace A2037_6 =0 if C3011_B ==. & Z1004=="BRA_2006"
replace A2037_6 =0 if C3011_D ==. & Z1004=="BRA_2006"
*list A2037_6 C3011_B C3011_D if Z1004=="BRA_2006"
*tab A2037_6 if Z1004=="BRA_2006", missing


***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="BRA_2006"
*tab A2037 if Z1004=="BRA_2006"

*ii)correct placement of parties on the left-right is following the 
*4 parties
replace A2038_1 =1 if C3011_A>5 & Z1004=="BRA_2006"
replace A2038_1 =0 if C3011_A==5 & Z1004=="BRA_2006"
replace A2038_1 =0 if C3011_A<5  & Z1004=="BRA_2006"
replace A2038_1 =0 if C3011_A==.  & Z1004=="BRA_2006"
*tab A2038_1 if Z1004=="BRA_2006"

replace A2038_2 =1 if C3011_B<5 & Z1004=="BRA_2006"
replace A2038_2 =0 if C3011_B==5 & Z1004=="BRA_2006"
replace A2038_2 =0 if C3011_B>5  & Z1004=="BRA_2006"
replace A2038_2 =0 if C3011_B==.  & Z1004=="BRA_2006"
*list A2038_2 C3011_B if Z1004=="BRA_2006"
*tab A2038_2 if Z1004=="BRA_2006"

replace A2038_3 =0 if C3011_C>5 & Z1004=="BRA_2006"
replace A2038_3 =1 if C3011_C==5 & Z1004=="BRA_2006"
replace A2038_3 =0 if C3011_C<5  & Z1004=="BRA_2006"
replace A2038_3 =0 if C3011_C==.  & Z1004=="BRA_2006"
*tab A2038_3 if Z1004=="BRA_2006"
*list C3011_C A2038_3 if Z1004=="BRA_2006"

replace A2038_4 =1 if C3011_D>5 & Z1004=="BRA_2006"
replace A2038_4 =0 if C3011_D==5 & Z1004=="BRA_2006"
replace A2038_4 =0 if C3011_D<5  & Z1004=="BRA_2006"
replace A2038_4 =0 if C3011_D==.  & Z1004=="BRA_2006"
*list C3011_D A2038_4 if Z1004=="BRA_2006"
*tab A2038_4 if Z1004=="BRA_2006"

replace A2038_5 =1 if C3011_F>5 & Z1004=="BRA_2006"
replace A2038_5 =0 if C3011_F==5 & Z1004=="BRA_2006"
replace A2038_5 =0 if C3011_F<5  & Z1004=="BRA_2006"
replace A2038_5 =0 if C3011_F==.  & Z1004=="BRA_2006"
*list C3011_F A2038_5 if Z1004=="BRA_2006"
*tab A2038_5 if Z1004=="BRA_2006"

replace A2038_6 =1 if C3011_E<5 & Z1004=="BRA_2006"
replace A2038_6 =0 if C3011_E==5 & Z1004=="BRA_2006"
replace A2038_6 =0 if C3011_E>5  & Z1004=="BRA_2006"
replace A2038_6 =0 if C3011_E==.  & Z1004=="BRA_2006"
*list C3011_E A2038_5 if Z1004=="BRA_2006"
*tab A2038_6 if Z1004=="BRA_2006"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="BRA_2006"
*tab A2038 if Z1004=="BRA_2006"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="BRA_2006"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="BRA_2006"
*tab  A2039_1 if Z1004=="BRA_2006"
***missings
sum C3011_A if Z1004=="BRA_2006"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="BRA_2006"
replace A2039_1_b= C5017_A-(5.74+3.04) if C3011_A==. & Z1004=="BRA_2006"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="BRA_2006"
*tab  A2039_1_b if Z1004=="BRA_2006"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="BRA_2006"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="BRA_2006"
*tab  A2039_2 if Z1004=="BRA_2006"
***missings
sum C3011_B if Z1004=="BRA_2006"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="BRA_2006"
replace A2039_2_b= C5017_B-(4.04+3.61) if C3011_B==. & Z1004=="BRA_2006"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="BRA_2006"
*tab  A2039_2_b if Z1004=="BRA_2006"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="BRA_2006"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="BRA_2006"
*tab  A2039_3 if Z1004=="BRA_2006"
***missings
sum C3011_C if Z1004=="BRA_2006"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="BRA_2006"
replace A2039_3_b= C5017_C-(5.73+3.38) if C3011_C==. & Z1004=="BRA_2006"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="BRA_2006"
*tab  A2039_3_b if Z1004=="BRA_2006"

**Party D
replace A2039_4 = C5017_D-C3011_D if Z1004=="BRA_2006"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="BRA_2006"
*tab  A2039_4 if Z1004=="BRA_2006"
***missings
sum C3011_D if Z1004=="BRA_2006"
replace A2039_4_b = C5017_D-C3011_D if Z1004=="BRA_2006"
replace A2039_4_b= C5017_D-(5.45+3.29) if C3011_D==. & Z1004=="BRA_2006"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="BRA_2006"
*tab  A2039_4_b if Z1004=="BRA_2006"

**Party F
replace A2039_5 = C5017_F-C3011_F if Z1004=="BRA_2006"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="BRA_2006"
*tab  A2039_5 if Z1004=="BRA_2006"
***missings
sum C3011_F if Z1004=="BRA_2006"
replace A2039_5_b = C5017_F-C3011_F if Z1004=="BRA_2006"
replace A2039_5_b= C5017_F-(4.51+2.96) if C3011_F==. & Z1004=="BRA_2006"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="BRA_2006"
*tab  A2039_5_b if Z1004=="BRA_2006"

**Party E
replace A2039_6 = C5017_E-C3011_E if Z1004=="BRA_2006"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="BRA_2006"
*tab  A2039_6 if Z1004=="BRA_2006"
***missings
sum C3011_E if Z1004=="BRA_2006"
replace A2039_6_b = C5017_E-C3011_E if Z1004=="BRA_2006"
replace A2039_6_b= C5017_E-(4.02+2.98) if C3011_E==. & Z1004=="BRA_2006"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="BRA_2006"
*tab  A2039_6_b if Z1004=="BRA_2006"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6)/6 if Z1004=="BRA_2006"
sum  A2039 if Z1004=="BRA_2006"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b)/6 if Z1004=="BRA_2006"
sum A2039_B if Z1004=="BRA_2006"


****************************************************************************************
*BRA_2010
*tab C5017_A if Z1004=="BRA_2010" 
*tab C5017_B if Z1004=="BRA_2010" 
*tab C5017_C if Z1004=="BRA_2010" 
*tab C5017_E if Z1004=="BRA_2010"  
*tab C5017_H if Z1004=="BRA_2010" 
*tab C5017_I if Z1004=="BRA_2010" 

*tab C3011_A if Z1004=="BRA_2010", mis
*tab C3011_B if Z1004=="BRA_2010", mis
*tab C3011_C if Z1004=="BRA_2010", mis
*tab C3011_E if Z1004=="BRA_2010", mis
*tab C3011_H if Z1004=="BRA_2010", mis
*tab C3011_I if Z1004=="BRA_2010", mis


mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2010"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2010"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2010"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2010"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2010"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2010"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2010"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2010"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="BRA_2010"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*6 parties 
** A H C B I E
replace A2037_1 =1 if C3011_A< C3011_H & Z1004=="BRA_2010"
replace A2037_1 =0 if C3011_A> C3011_H & Z1004=="BRA_2010"
replace A2037_1 =0 if C3011_A == C3011_H & Z1004=="BRA_2010"
replace A2037_1 =0 if C3011_A ==. & Z1004=="BRA_2010"
replace A2037_1 =0 if C3011_H ==. & Z1004=="BRA_2010"
*list A2037_1 C3011_H C3011_A if Z1004=="BRA_2010"
*tab A2037_1 if Z1004=="BRA_2010", miss

replace A2037_2 =1 if C3011_H< C3011_C & Z1004=="BRA_2010"
replace A2037_2 =0 if C3011_H> C3011_C & Z1004=="BRA_2010"
replace A2037_2 =0 if C3011_H == C3011_C & Z1004=="BRA_2010"
replace A2037_2 =0 if C3011_H ==. & Z1004=="BRA_2010"
replace A2037_2 =0 if C3011_C ==. & Z1004=="BRA_2010"
*list A2037_2 C3011_A C3011_F if Z1004=="BRA_2010"
*tab A2037_2 if Z1004=="BRA_2010"

replace A2037_3 =1 if C3011_C< C3011_B & Z1004=="BRA_2010"
replace A2037_3 =0 if C3011_C> C3011_B & Z1004=="BRA_2010"
replace A2037_3 =0 if C3011_C == C3011_B & Z1004=="BRA_2010"
replace A2037_3 =0 if C3011_C ==. & Z1004=="BRA_2010"
replace A2037_3 =0 if C3011_B ==. & Z1004=="BRA_2010"
*list A2037_3 C3011_F C3011_G if Z1004=="BRA_2010"
*tab A2037_3 if Z1004=="BRA_2010"

replace A2037_4 =0 if C3011_I< C3011_B & Z1004=="BRA_2010"
replace A2037_4 =0 if C3011_I> C3011_B & Z1004=="BRA_2010"
replace A2037_4 =1 if C3011_I == C3011_B & Z1004=="BRA_2010"
replace A2037_4 =0 if C3011_I ==. & Z1004=="BRA_2010"
replace A2037_4 =0 if C3011_B ==. & Z1004=="BRA_2010"
*list A2037_4 C3011_F C3011_G if Z1004=="BRA_2010"
*tab A2037_4 if Z1004=="BRA_2010"

replace A2037_5 =1 if C3011_I< C3011_E & Z1004=="BRA_2010"
replace A2037_5 =0 if C3011_I> C3011_E & Z1004=="BRA_2010"
replace A2037_5 =0 if C3011_I == C3011_E & Z1004=="BRA_2010"
replace A2037_5 =0 if C3011_I ==. & Z1004=="BRA_2010"
replace A2037_5 =0 if C3011_E ==. & Z1004=="BRA_2010"
*list A2037_5 C3011_I C3011_E if Z1004=="BRA_2010"
*tab A2037_5 if Z1004=="BRA_2010", missing

replace A2037_6 =1 if C3011_A< C3011_E & Z1004=="BRA_2010"
replace A2037_6 =0 if C3011_A> C3011_E & Z1004=="BRA_2010"
replace A2037_6 =0 if C3011_A == C3011_E & Z1004=="BRA_2010"
replace A2037_6 =0 if C3011_A ==. & Z1004=="BRA_2010"
replace A2037_6 =0 if C3011_E ==. & Z1004=="BRA_2010"
*list A2037_6 C3011_A C3011_E if Z1004=="BRA_2010"
*tab A2037_6 if Z1004=="BRA_2010", missing


***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="BRA_2010"
*tab A2037 if Z1004=="BRA_2010"

*ii)correct placement of parties on the left-right is following the 
*4 parties
replace A2038_1 =1 if C3011_A<5 & Z1004=="BRA_2010"
replace A2038_1 =0 if C3011_A==5 & Z1004=="BRA_2010"
replace A2038_1 =0 if C3011_A>5  & Z1004=="BRA_2010"
replace A2038_1 =0 if C3011_A==.  & Z1004=="BRA_2010"
*tab A2038_1 if Z1004=="BRA_2010"

replace A2038_2 =1 if C3011_B>5 & Z1004=="BRA_2010"
replace A2038_2 =0 if C3011_B==5 & Z1004=="BRA_2010"
replace A2038_2 =0 if C3011_B<5  & Z1004=="BRA_2010"
replace A2038_2 =0 if C3011_B==.  & Z1004=="BRA_2010"
*list A2038_2 C3011_B if Z1004=="BRA_2010"
*tab A2038_2 if Z1004=="BRA_2010"

replace A2038_3 =0 if C3011_C>5 & Z1004=="BRA_2010"
replace A2038_3 =1 if C3011_C==5 & Z1004=="BRA_2010"
replace A2038_3 =0 if C3011_C<5  & Z1004=="BRA_2010"
replace A2038_3 =0 if C3011_C==.  & Z1004=="BRA_2010"
*tab A2038_3 if Z1004=="BRA_2010"
*list C3011_C A2038_3 if Z1004=="BRA_2010"


replace A2038_6 =1 if C3011_E>5 & Z1004=="BRA_2010"
replace A2038_6 =0 if C3011_E==5 & Z1004=="BRA_2010"
replace A2038_6 =0 if C3011_E<5  & Z1004=="BRA_2010"
replace A2038_6 =0 if C3011_E==.  & Z1004=="BRA_2010"
*list C3011_E A2038_5 if Z1004=="BRA_2010"
*tab A2038_6 if Z1004=="BRA_2010"

replace A2038_7 =1 if C3011_H<5 & Z1004=="BRA_2010"
replace A2038_7 =0 if C3011_H==5 & Z1004=="BRA_2010"
replace A2038_7 =0 if C3011_H>5  & Z1004=="BRA_2010"
replace A2038_7 =0 if C3011_H==.  & Z1004=="BRA_2010"
*list C3011_H A2038_5 if Z1004=="BRA_2010"
*tab A2038_7 if Z1004=="BRA_2010"


replace A2038_5 =1 if C3011_I<5 & Z1004=="BRA_2010"
replace A2038_5 =0 if C3011_I==5 & Z1004=="BRA_2010"
replace A2038_5 =0 if C3011_I>5  & Z1004=="BRA_2010"
replace A2038_5 =0 if C3011_I==.  & Z1004=="BRA_2010"
*list C3011_H A2038_5 if Z1004=="BRA_2010"
*tab A2038_5 if Z1004=="BRA_2010"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_5+A2038_6+A2038_7)/6 if Z1004=="BRA_2010"
*tab A2038 if Z1004=="BRA_2010"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="BRA_2010"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="BRA_2010"
*tab  A2039_1 if Z1004=="BRA_2010"
***missings
sum C3011_A if Z1004=="BRA_2010"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="BRA_2010"
replace A2039_1_b= C5017_A-(4.61+3.84) if C3011_A==. & Z1004=="BRA_2010"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="BRA_2010"
*tab  A2039_1_b if Z1004=="BRA_2010"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="BRA_2010"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="BRA_2010"
*tab  A2039_2 if Z1004=="BRA_2010"
***missings
sum C3011_B if Z1004=="BRA_2010"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="BRA_2010"
replace A2039_2_b= C5017_B-(6.19+2.99) if C3011_B==. & Z1004=="BRA_2010"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="BRA_2010"
*tab  A2039_2_b if Z1004=="BRA_2010"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="BRA_2010"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="BRA_2010"
*tab  A2039_3 if Z1004=="BRA_2010"
***missings
sum C3011_C if Z1004=="BRA_2010"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="BRA_2010"
replace A2039_3_b= C5017_C-(5.88+3.47) if C3011_C==. & Z1004=="BRA_2010"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="BRA_2010"
*tab  A2039_3_b if Z1004=="BRA_2010"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="BRA_2010"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="BRA_2010"
*tab  A2039_4 if Z1004=="BRA_2010"
***missings
sum C3011_E if Z1004=="BRA_2010"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="BRA_2010"
replace A2039_4_b= C5017_E-(5.15+3.45) if C3011_E==. & Z1004=="BRA_2010"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="BRA_2010"
*tab  A2039_4_b if Z1004=="BRA_2010"

**Party H
replace A2039_5 = C5017_H-C3011_H if Z1004=="BRA_2010"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="BRA_2010"
*tab  A2039_5 if Z1004=="BRA_2010"
***missings
sum C3011_H if Z1004=="BRA_2010"
replace A2039_5_b = C5017_H-C3011_H if Z1004=="BRA_2010"
replace A2039_5_b= C5017_H-(4.08+2.90) if C3011_H==. & Z1004=="BRA_2010"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="BRA_2010"
*tab  A2039_5_b if Z1004=="BRA_2010"

**Party I
replace A2039_6 = C5017_I-C3011_I if Z1004=="BRA_2010"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="BRA_2010"
*tab  A2039_6 if Z1004=="BRA_2010"
***missings
sum C3011_E if Z1004=="BRA_2010"
replace A2039_6_b = C5017_I-C3011_I if Z1004=="BRA_2010"
replace A2039_6_b= C5017_I-(5.15+3.45) if C3011_I==. & Z1004=="BRA_2010"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="BRA_2010"
*tab  A2039_6_b if Z1004=="BRA_2010"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6)/6 if Z1004=="BRA_2010"
sum A2039 if Z1004=="BRA_2010"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b)/6 if Z1004=="BRA_2010"
sum  A2039_B if Z1004=="BRA_2010"


****************************************************************************************
**CAN_1997


sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="CAN_1997"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="CAN_1997"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*5 parties (so 5-4) to most left to most right?
*E, D, A, C, B
replace A2037_1 =0 if A3032_E< A3032_D & Z1004=="CAN_1997"
replace A2037_1 =0 if A3032_E> A3032_D & Z1004=="CAN_1997"
replace A2037_1 =1 if A3032_E == A3032_D & Z1004=="CAN_1997"
replace A2037_1 =0 if A3032_E ==. & Z1004=="CAN_1997"
replace A2037_1 =0 if A3032_D ==. & Z1004=="CAN_1997"
*list A2037_1 A3032_D A3032_E if Z1004=="CAN_1997"
*tab A2037_1 if Z1004=="CAN_1997"

replace A2037_2 =1 if A3032_D< A3032_A & Z1004=="CAN_1997"
replace A2037_2 =0 if A3032_D> A3032_A & Z1004=="CAN_1997"
replace A2037_2 =0 if A3032_D == A3032_A & Z1004=="CAN_1997"
replace A2037_2 =0 if A3032_D ==. & Z1004=="CAN_1997"
replace A2037_2 =0 if A3032_A ==. & Z1004=="CAN_1997"
*list A2037_2 A3032_D A3032_A if Z1004=="CAN_1997"
*tab A2037_2 if Z1004=="CAN_1997"

replace A2037_3 =1 if A3032_A< A3032_C & Z1004=="CAN_1997"
replace A2037_3 =0 if A3032_A> A3032_C & Z1004=="CAN_1997"
replace A2037_3 =0 if A3032_A == A3032_C & Z1004=="CAN_1997"
replace A2037_3 =0 if A3032_A ==. & Z1004=="CAN_1997"
replace A2037_3 =0 if A3032_C ==. & Z1004=="CAN_1997"
*list A2037_3 A3032_A A3032_B if Z1004=="CAN_1997"
*tab A2037_3 if Z1004=="CAN_1997"

replace A2037_4 =1 if A3032_C< A3032_B & Z1004=="CAN_1997"
replace A2037_4 =0 if A3032_C> A3032_B & Z1004=="CAN_1997"
replace A2037_4 =0 if A3032_C == A3032_B & Z1004=="CAN_1997" 
replace A2037_4 =0 if A3032_B ==. & Z1004=="CAN_1997"
replace A2037_4 =0 if A3032_C ==. & Z1004=="CAN_1997"
*list A2037_4 A3032_B A3032_C if Z1004=="CAN_1997" 
*tab A2037_4 if Z1004=="CAN_1997"

***last 
replace A2037_5 =1 if A3032_E< A3032_B & Z1004=="CAN_1997"
replace A2037_5 =0 if A3032_E> A3032_B & Z1004=="CAN_1997"
replace A2037_5 =0 if A3032_E == A3032_B & Z1004=="CAN_1997"
replace A2037_5 =0 if A3032_E ==. & Z1004=="CAN_1997"
replace A2037_5 =0 if A3032_B ==. & Z1004=="CAN_1997"
*list A2037_5 A3032_E A3032_B if Z1004=="CAN_1997"
*tab A2037_5 if Z1004=="CAN_1997", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="CAN_1997"
*tab A2037 if Z1004=="CAN_1997"

**)correct placement of parties on the left-right is following the 

*5 parties (so 5-4) to most left to most right?
*E, D, A, B, C
replace A2038_1 =0 if A3032_A<5 & Z1004=="CAN_1997"
replace A2038_1 =1 if A3032_A==5 & Z1004=="CAN_1997"
replace A2038_1 =0 if A3032_A>5  & Z1004=="CAN_1997"
replace A2038_1 =0 if A3032_A==.  & Z1004=="CAN_1997"
*tab A2038_1 if Z1004=="CAN_1997"

replace A2038_2 =1 if A3032_B>5 & Z1004=="CAN_1997"
replace A2038_2 =0 if A3032_B==5 & Z1004=="CAN_1997"
replace A2038_2 =0 if A3032_B<5  & Z1004=="CAN_1997"
replace A2038_2 =0 if A3032_B==.  & Z1004=="CAN_1997"
*tab A2038_2 if Z1004=="CAN_1997"

replace A2038_3 =1 if A3032_C>5 & Z1004=="CAN_1997"
replace A2038_3 =0 if A3032_C==5 & Z1004=="CAN_1997"
replace A2038_3 =0 if A3032_C<5  & Z1004=="CAN_1997"
replace A2038_3 =0 if A3032_C==.  & Z1004=="CAN_1997"
*tab A2038_3 if Z1004=="CAN_1997"
*list A3032_C A2038_3 if Z1004=="CAN_1997"

replace A2038_4 =1 if A3032_D<5 & Z1004=="CAN_1997"
replace A2038_4 =0 if A3032_D==5 & Z1004=="CAN_1997"
replace A2038_4 =0 if A3032_D>5  & Z1004=="CAN_1997"
replace A2038_4 =0 if A3032_D==.  & Z1004=="CAN_1997"
*list A3032_D A2038_4 if Z1004=="CAN_1997"
*tab A2038_4 if Z1004=="CAN_1997"

replace A2038_5 =1 if A3032_E<5 & Z1004=="CAN_1997"
replace A2038_5 =0 if A3032_E==5 & Z1004=="CAN_1997"
replace A2038_5 =0 if A3032_E>5  & Z1004=="CAN_1997"
replace A2038_5 =0 if A3032_E==.  & Z1004=="CAN_1997"
*list A3032_E A2038_5 if Z1004=="CAN_1997"
*tab A2038_5 if Z1004=="CAN_1997"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="CAN_1997"
*tab A2038 if Z1004=="CAN_1997"

**version iii
***The third operationalization of political knowledge through party placements
*** uses the averaged absolute distance between respondent�s party placements 

sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="CAN_1997"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="CAN_1997"

**Party A
replace A2039_1 = A5004_A-A3032_A if Z1004=="CAN_1997"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="CAN_1997"
*tab  A2039_1 if Z1004=="CAN_1997"
***missings
sum A3032_A if Z1004=="CAN_1997"
replace A2039_1_b = A5004_A-A3032_A if Z1004=="CAN_1997"
replace A2039_1_b= A5004_A-(5.40+2.11) if A3032_A==. & Z1004=="CAN_1997"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="CAN_1997"
*tab  A2039_1_b if Z1004=="CAN_1997"

**Party B
replace A2039_2 = A5004_B-A3032_B if Z1004=="CAN_1997"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="CAN_1997"
*tab  A2039_2 if Z1004=="CAN_1997"
***missings
sum A3032_B if Z1004=="CAN_1997"
replace A2039_2_b = A5004_B-A3032_B if Z1004=="CAN_1997"
replace A2039_2_b= A5004_B-(5.96+3.31) if A3032_B==. & Z1004=="CAN_1997"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="CAN_1997"
*tab  A2039_2_b if Z1004=="CAN_1997"

**Party C
replace A2039_3 = A5004_C-A3032_C if Z1004=="CAN_1997"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="CAN_1997"
*tab  A2039_3 if Z1004=="CAN_1997"
***missings
sum A3032_C if Z1004=="CAN_1997"
replace A2039_3_b = A5004_C-A3032_C if Z1004=="CAN_1997"
replace A2039_3_b= A5004_C-(5.91+2.19) if A3032_C==. & Z1004=="CAN_1997"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="CAN_1997"
*tab  A2039_3_b if Z1004=="CAN_1997"

**Party D
replace A2039_4 = A5004_D-A3032_D if Z1004=="CAN_1997"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="CAN_1997"
*tab  A2039_4 if Z1004=="CAN_1997"
***missings
sum A3032_D if Z1004=="CAN_1997"
replace A2039_4_b = A5004_D-A3032_D if Z1004=="CAN_1997"
replace A2039_4_b= A5004_D-(3.36+2.17) if A3032_D==. & Z1004=="CAN_1997"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="CAN_1997"
*tab  A2039_4_b if Z1004=="CAN_1997"

**Party E
replace A2039_5 = A5004_E-A3032_E if Z1004=="CAN_1997"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="CAN_1997"
*tab  A2039_5 if Z1004=="CAN_1997"
***missings
sum A3032_E if Z1004=="CAN_1997"
replace A2039_5_b = A5004_E-A3032_E if Z1004=="CAN_1997"
replace A2039_5_b= A5004_E-(3.6+3.18) if A3032_E==. & Z1004=="CAN_1997"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="CAN_1997"
*tab  A2039_5_b if Z1004=="CAN_1997"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5)/5 if Z1004=="CAN_1997"
*tab  A2039 if Z1004=="CAN_1997"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b)/5 if Z1004=="CAN_1997"
**tab  A2039_B if Z1004=="CAN_1997", miss


****************************************************************************************
*"CAN_2004"
*tab B5018_A if Z1004=="CAN_2004"
*tab B5018_B if Z1004=="CAN_2004" 
*tab B5018_C if Z1004=="CAN_2004" 
*tab B5018_D if Z1004=="CAN_2004" 

*tab B3038_A if Z1004=="CAN_2004"
*tab B3038_B if Z1004=="CAN_2004"
*tab B3038_C if Z1004=="CAN_2004"
*tab B3038_D if Z1004=="CAN_2004"

mvdecode B3038_A, mv(99), if Z1004=="CAN_2004"
mvdecode B3038_B, mv(99), if Z1004=="CAN_2004"
mvdecode B3038_C, mv(99), if Z1004=="CAN_2004"
mvdecode B3038_D, mv(99), if Z1004=="CAN_2004"
mvdecode B3038_F, mv(99), if Z1004=="CAN_2004"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*4 parties (so 5-4) to most left to most right?
*  C D A B
replace A2037_1 =0 if B3038_C< B3038_D & Z1004=="CAN_2004"
replace A2037_1 =0 if B3038_C> B3038_D & Z1004=="CAN_2004"
replace A2037_1 =1 if B3038_C == B3038_D & Z1004=="CAN_2004"
replace A2037_1 =0 if B3038_C ==. & Z1004=="CAN_2004"
replace A2037_1 =0 if B3038_D ==. & Z1004=="CAN_2004"
*list A2037_1 B3038_C B3038_D if Z1004=="CAN_2004"
*tab A2037_1 if Z1004=="CAN_2004", miss

replace A2037_2 =1 if B3038_D< B3038_A & Z1004=="CAN_2004"
replace A2037_2 =0 if B3038_D> B3038_A & Z1004=="CAN_2004"
replace A2037_2 =0 if B3038_D == B3038_A & Z1004=="CAN_2004"
replace A2037_2 =0 if B3038_D ==. & Z1004=="CAN_2004"
replace A2037_2 =0 if B3038_A ==. & Z1004=="CAN_2004"
*list A2037_2 B3038_D B3038_A if Z1004=="CAN_2004"
*tab A2037_2 if Z1004=="CAN_2004"

replace A2037_3 =1 if B3038_A< B3038_B & Z1004=="CAN_2004"
replace A2037_3 =0 if B3038_A> B3038_B & Z1004=="CAN_2004"
replace A2037_3 =0 if B3038_A == B3038_B & Z1004=="CAN_2004"
replace A2037_3 =0 if B3038_A ==. & Z1004=="CAN_2004"
replace A2037_3 =0 if B3038_B ==. & Z1004=="CAN_2004"
*list A2037_3 B3038_A B3038_B if Z1004=="CAN_2004"
*tab A2037_3 if Z1004=="CAN_2004"

replace A2037_4 =1 if B3038_C< B3038_B & Z1004=="CAN_2004"
replace A2037_4 =0 if B3038_C> B3038_B & Z1004=="CAN_2004"
replace A2037_4 =0 if B3038_C == B3038_B & Z1004=="CAN_2004" 
replace A2037_4 =. if B3038_B & B3038_C==. & Z1004=="CAN_2004"
*list A2037_4 B3038_B B3038_C if Z1004=="CAN_2004" 
*tab A2037_4 if Z1004=="CAN_2004"

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4)/4 if Z1004=="CAN_2004"
*tab A2037  if Z1004=="CAN_2004"

*)correct placement of parties on the left-right is following the 
*5 parties
replace A2038_1 =0 if B3038_A>5 & Z1004=="CAN_2004"
replace A2038_1 =1 if B3038_A==5 & Z1004=="CAN_2004"
replace A2038_1 =0 if B3038_A<5  & Z1004=="CAN_2004"
replace A2038_1 =0 if B3038_A==.  & Z1004=="CAN_2004"
*tab A2038_1 if Z1004=="CAN_2004"

replace A2038_2 =1 if B3038_B>5 & Z1004=="CAN_2004"
replace A2038_2 =0 if B3038_B==5 & Z1004=="CAN_2004"
replace A2038_2 =0 if B3038_B<5  & Z1004=="CAN_2004"
replace A2038_2 =0 if B3038_B==.  & Z1004=="CAN_2004"
*list A2038_2 B3038_B if Z1004=="CAN_2004"
*tab A2038_2 if Z1004=="CAN_2004"

replace A2038_3 =1 if B3038_C<5 & Z1004=="CAN_2004"
replace A2038_3 =0 if B3038_C==5 & Z1004=="CAN_2004"
replace A2038_3 =0 if B3038_C>5  & Z1004=="CAN_2004"
replace A2038_3 =0 if B3038_C==.  & Z1004=="CAN_2004"
*tab A2038_3 if Z1004=="CAN_2004"
*list B3038_C A2038_3 if Z1004=="CAN_2004"

replace A2038_4 =1 if B3038_D<5 & Z1004=="CAN_2004"
replace A2038_4 =0 if B3038_D==5 & Z1004=="CAN_2004"
replace A2038_4 =0 if B3038_D>5  & Z1004=="CAN_2004"
replace A2038_4 =0 if B3038_D==.  & Z1004=="CAN_2004"
*list B3038_D A2038_4 if Z1004=="CAN_2004"
*tab A2038_4 if Z1004=="CAN_2004"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4)/4 if Z1004=="CAN_2004"
*tab A2038 if Z1004=="CAN_2004"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="CAN_2004"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="CAN_2004"
*tab  A2039_1 if Z1004=="CAN_2004"
***missings
sum B3038_A if Z1004=="CAN_2004"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="CAN_2004"
replace A2039_1_b= B5018_A-(5.07+2.23) if B3038_A==. & Z1004=="CAN_2004"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="CAN_2004"
*tab  A2039_1_b if Z1004=="CAN_2004"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="CAN_2004"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="CAN_2004"
*tab  A2039_2 if Z1004=="CAN_2004"
***missings
sum B3038_B if Z1004=="CAN_2004"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="CAN_2004"
replace A2039_2_b= B5018_B-(6.28+2.58) if B3038_B==. & Z1004=="CAN_2004"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="CAN_2004"
*tab  A2039_2_b if Z1004=="CAN_2004"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="CAN_2004"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="CAN_2004"
*tab  A2039_3 if Z1004=="CAN_2004"
***missings
sum B3038_C if Z1004=="CAN_2004"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="CAN_2004"
replace A2039_3_b= B5018_C-(3.38+2.18) if B3038_C==. & Z1004=="CAN_2004"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="CAN_2004"
*tab  A2039_3_b if Z1004=="CAN_2004"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="CAN_2004"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="CAN_2004"
*tab  A2039_4 if Z1004=="CAN_2004"
***missings
sum B3038_D if Z1004=="CAN_2004"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="CAN_2004"
replace A2039_4_b= B5018_D-(3.68+2.91) if B3038_D==. & Z1004=="CAN_2004"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="CAN_2004"
*tab  A2039_4_b if Z1004=="CAN_2004"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4)/4 if Z1004=="CAN_2004"
sum  A2039 if Z1004=="CAN_2004"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b)/4 if Z1004=="CAN_2004"
sum  A2039_B if Z1004=="CAN_2004"


****************************************************************************************
**CAN_2008

*tab C5017_A if Z1004=="CAN_2008" 
*tab C5017_B if Z1004=="CAN_2008" 
*tab C5017_C if Z1004=="CAN_2008" 
*tab C5017_D if Z1004=="CAN_2008" 
*tab C5017_E if Z1004=="CAN_2008"  


*tab C3011_A if Z1004=="CAN_2008", mis
*tab C3011_B if Z1004=="CAN_2008", mis
*tab C3011_C if Z1004=="CAN_2008", mis
*tab C3011_D if Z1004=="CAN_2008", mis
*tab C3011_E if Z1004=="CAN_2008", mis


**MISSING IS REALLY MISSING HERE BECAUSE OF THE SAMPLING
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="CAN_2008"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="CAN_2008"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="CAN_2008"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="CAN_2008"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="CAN_2008"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="CAN_2008"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="CAN_2008"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="CAN_2008"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="CAN_2008"


***droping other sample components
drop if C1007==1 & Z1004=="CAN_2008"
drop if C1007==2 & Z1004=="CAN_2008"
drop if C1007==4 & Z1004=="CAN_2008"
**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*5 parties 
** DCEBA
replace A2037_1 =0 if C3011_C< C3011_E & Z1004=="CAN_2008"
replace A2037_1 =0 if C3011_C> C3011_E & Z1004=="CAN_2008"
replace A2037_1 =1 if C3011_C == C3011_E & Z1004=="CAN_2008"
replace A2037_1 =0 if C3011_C ==. & Z1004=="CAN_2008"
replace A2037_1 =0 if C3011_E ==. & Z1004=="CAN_2008"
*list A2037_1 C3011_E C3011_C if Z1004=="CAN_2008"
*tab A2037_1 if Z1004=="CAN_2008", miss

replace A2037_2 =0 if C3011_E< C3011_D & Z1004=="CAN_2008"
replace A2037_2 =0 if C3011_E> C3011_D & Z1004=="CAN_2008"
replace A2037_2 =1 if C3011_E == C3011_D & Z1004=="CAN_2008"
replace A2037_2 =0 if C3011_E ==. & Z1004=="CAN_2008"
replace A2037_2 =0 if C3011_D ==. & Z1004=="CAN_2008"
*list A2037_2 C3011_D C3011_E if Z1004=="CAN_2008"
*tab A2037_2 if Z1004=="CAN_2008", miss

replace A2037_3 =0 if C3011_D< C3011_C & Z1004=="CAN_2008"
replace A2037_3 =0 if C3011_D> C3011_C & Z1004=="CAN_2008"
replace A2037_3 =1 if C3011_D == C3011_C & Z1004=="CAN_2008"
replace A2037_3 =0 if C3011_D ==. & Z1004=="CAN_2008"
replace A2037_3 =0 if C3011_C ==. & Z1004=="CAN_2008"
*list A2037_3 C3011_C C3011_D if Z1004=="CAN_2008"
*tab A2037_3 if Z1004=="CAN_2008", miss

replace A2037_4 =1 if C3011_C< C3011_B & Z1004=="CAN_2008"
replace A2037_4 =0 if C3011_C> C3011_B & Z1004=="CAN_2008"
replace A2037_4 =1 if C3011_C == C3011_B & Z1004=="CAN_2008"
replace A2037_4 =0 if C3011_C ==. & Z1004=="CAN_2008"
replace A2037_4 =0 if C3011_B ==. & Z1004=="CAN_2008"
*list A2037_4 C3011_F C3011_G if Z1004=="CAN_2008"
*tab A2037_4 if Z1004=="CAN_2008"

replace A2037_5 =1 if C3011_B< C3011_A & Z1004=="CAN_2008"
replace A2037_5 =0 if C3011_B> C3011_A & Z1004=="CAN_2008"
replace A2037_5 =0 if C3011_B == C3011_A & Z1004=="CAN_2008"
replace A2037_5 =0 if C3011_B ==. & Z1004=="CAN_2008"
replace A2037_5 =0 if C3011_A ==. & Z1004=="CAN_2008"
*list A2037_1 C3011_D C3011_C if Z1004=="CAN_2008"
*tab A2037_1 if Z1004=="CAN_2008", miss

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="CAN_2008"
*tab A2037 if Z1004=="CAN_2008"

*ii)correct placement of parties on the left-right is following the 
*4 parties
replace A2038_1 =0 if C3011_A<5 & Z1004=="CAN_2008"
replace A2038_1 =0 if C3011_A==5 & Z1004=="CAN_2008"
replace A2038_1 =1 if C3011_A>5  & Z1004=="CAN_2008"
replace A2038_1 =0 if C3011_A==.  & Z1004=="CAN_2008"
*tab A2038_1 if Z1004=="CAN_2008"

replace A2038_2 =0 if C3011_B>5 & Z1004=="CAN_2008"
replace A2038_2 =1 if C3011_B==5 & Z1004=="CAN_2008"
replace A2038_2 =0 if C3011_B<5  & Z1004=="CAN_2008"
replace A2038_2 =0 if C3011_B==.  & Z1004=="CAN_2008"
*list A2038_2 C3011_B if Z1004=="CAN_2008"
*tab A2038_2 if Z1004=="CAN_2008"

replace A2038_3 =0 if C3011_C>5 & Z1004=="CAN_2008"
replace A2038_3 =0 if C3011_C==5 & Z1004=="CAN_2008"
replace A2038_3 =1 if C3011_C<5  & Z1004=="CAN_2008"
replace A2038_3 =0 if C3011_C==.  & Z1004=="CAN_2008"
*tab A2038_3 if Z1004=="CAN_2008"
*list C3011_C A2038_3 if Z1004=="CAN_2008"

replace A2038_4 =1 if C3011_D<5 & Z1004=="CAN_2008"
replace A2038_4 =0 if C3011_D==5 & Z1004=="CAN_2008"
replace A2038_4 =0 if C3011_D>5  & Z1004=="CAN_2008"
replace A2038_4 =0 if C3011_D==.  & Z1004=="CAN_2008"
*list C3011_D A2038_4 if Z1004=="CAN_2008"
*tab A2038_4 if Z1004=="CAN_2008"

replace A2038_5 =1 if C3011_E<5 & Z1004=="CAN_2008"
replace A2038_5 =0 if C3011_E==5 & Z1004=="CAN_2008"
replace A2038_5 =0 if C3011_E>5  & Z1004=="CAN_2008"
replace A2038_5 =0 if C3011_E==.  & Z1004=="CAN_2008"
*list C3011_D A2038_4 if Z1004=="CAN_2008"
*tab A2038_4 if Z1004=="CAN_2008"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="CAN_2008"
*tab A2038 if Z1004=="CAN_2008"

**version iii

**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="CAN_2008"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="CAN_2008"
*tab  A2039_1 if Z1004=="CAN_2008"
***missings
sum C3011_A if Z1004=="CAN_2008"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="CAN_2008"
replace A2039_1_b= C5017_A-(6.92+2.42) if C3011_A==. & Z1004=="CAN_2008"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="CAN_2008"
*tab  A2039_1_b if Z1004=="CAN_2008"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="CAN_2008"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="CAN_2008"
*tab  A2039_2 if Z1004=="CAN_2008"
***missings
sum C3011_B if Z1004=="CAN_2008"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="CAN_2008"
replace A2039_2_b= C5017_B-(4.99+2) if C3011_B==. & Z1004=="CAN_2008"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="CAN_2008"
*tab  A2039_2_b if Z1004=="CAN_2008"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="CAN_2008"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="CAN_2008"
*tab  A2039_3 if Z1004=="CAN_2008"
***missings
sum C3011_C if Z1004=="CAN_2008"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="CAN_2008"
replace A2039_3_b= C5017_C-(3.68+2.59) if C3011_C==. & Z1004=="CAN_2008"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="CAN_2008"
*tab  A2039_3_b if Z1004=="CAN_2008"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="CAN_2008"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="CAN_2008"
*tab  A2039_4 if Z1004=="CAN_2008"
***missings
sum C3011_E if Z1004=="CAN_2008"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="CAN_2008"
replace A2039_4_b= C5017_E-(3.43+2.19) if C3011_E==. & Z1004=="CAN_2008"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="CAN_2008"
*tab  A2039_4_b if Z1004=="CAN_2008"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="CAN_2008"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="CAN_2008"
*tab  A2039_5 if Z1004=="CAN_2008"
***missings
sum C3011_D if Z1004=="CAN_2008"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="CAN_2008"
replace A2039_5_b= C5017_D-(3.53+2.05) if C3011_D==. & Z1004=="CAN_2008"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="CAN_2008"
*tab  A2039_5_b if Z1004=="CAN_2008"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5)/5 if Z1004=="CAN_2008"
**tab  A2039 if Z1004=="CAN_2008"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b)/5 if Z1004=="CAN_2008"
**tab  A2039_B if Z1004=="CAN_2008"



****************************************************************************************
***CZE_1996 

sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="CZE_1996"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="CZE_1996"
**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*6 parties  to most left to most right?
*CBDFAE (a=f)
replace A2037_1 =1 if A3032_C< A3032_B & Z1004=="CZE_1996"
replace A2037_1 =0 if A3032_C> A3032_B & Z1004=="CZE_1996"
replace A2037_1 =0 if A3032_C == A3032_B & Z1004=="CZE_1996"
replace A2037_1 =0 if A3032_C ==. & Z1004=="CZE_1996"
replace A2037_1 =0 if A3032_B ==. & Z1004=="CZE_1996"
*list A2037_1 A3032_C A3032_B if Z1004=="CZE_1996"
*tab A2037_1 if Z1004=="CZE_1996"

replace A2037_2 =1 if A3032_B< A3032_D & Z1004=="CZE_1996"
replace A2037_2 =0 if A3032_B> A3032_D & Z1004=="CZE_1996"
replace A2037_2 =0 if A3032_B == A3032_D & Z1004=="CZE_1996"
replace A2037_2 =0 if A3032_B ==. & Z1004=="CZE_1996"
replace A2037_2 =0 if A3032_D ==. & Z1004=="CZE_1996"
*list A2037_2 A3032_D A3032_A if Z1004=="CZE_1996"
*tab A2037_2 if Z1004=="CZE_1996"

replace A2037_3 =1 if A3032_D< A3032_F & Z1004=="CZE_1996"
replace A2037_3 =0 if A3032_D> A3032_F & Z1004=="CZE_1996"
replace A2037_3 =0 if A3032_D == A3032_F & Z1004=="CZE_1996"
replace A2037_3 =0 if A3032_D ==. & Z1004=="CZE_1996"
replace A2037_3 =0 if A3032_F ==. & Z1004=="CZE_1996"
*list A2037_3 A3032_D A3032_F if Z1004=="CZE_1996"
*tab A2037_3 if Z1004=="CZE_1996"

replace A2037_4 =0 if A3032_F< A3032_A & Z1004=="CZE_1996"
replace A2037_4 =0 if A3032_F> A3032_A & Z1004=="CZE_1996"
replace A2037_4 =1 if A3032_F == A3032_A & Z1004=="CZE_1996" 
replace A2037_4 =0 if A3032_F & A3032_A==. & Z1004=="CZE_1996"
replace A2037_4 =0 if A3032_F ==. & Z1004=="CZE_1996"
replace A2037_4 =0 if A3032_A ==. & Z1004=="CZE_1996"
*list A2037_4 A3032_A A3032_F if Z1004=="CZE_1996" 
*tab A2037_4 if Z1004=="CZE_1996"

replace A2037_5 =1 if A3032_A< A3032_E & Z1004=="CZE_1996"
replace A2037_5 =0 if A3032_A> A3032_E & Z1004=="CZE_1996"
replace A2037_5 =0 if A3032_A == A3032_E & Z1004=="CZE_1996"
replace A2037_5 =0 if A3032_A ==. & Z1004=="CZE_1996"
replace A2037_5 =0 if A3032_E ==. & Z1004=="CZE_1996"
*list A2037_5 A3032_A A3032_E if Z1004=="CZE_1996"
*tab A2037_5 if Z1004=="CZE_1996", missing

replace A2037_6 =1 if A3032_C< A3032_E & Z1004=="CZE_1996"
replace A2037_6 =0 if A3032_C> A3032_E & Z1004=="CZE_1996"
replace A2037_6 =0 if A3032_C == A3032_E & Z1004=="CZE_1996"
replace A2037_6 =0 if A3032_C ==. & Z1004=="CZE_1996"
replace A2037_6 =0 if A3032_E ==. & Z1004=="CZE_1996"
*list A2037_5 A3032_A A3032_E if Z1004=="CZE_1996"
*tab A2037_6 if Z1004=="CZE_1996", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="CZE_1996"
*tab A2037 if Z1004=="CZE_1996"

**ii)correct placement of parties on the left-right is following the 

replace A2038_1 =0 if A3032_A<5 & Z1004=="CZE_1996"
replace A2038_1 =0 if A3032_A==5 & Z1004=="CZE_1996"
replace A2038_1 =1 if A3032_A>5  & Z1004=="CZE_1996"
replace A2038_1 =0 if A3032_A==.  & Z1004=="CZE_1996"
*tab A2038_1 if Z1004=="CZE_1996"

replace A2038_2 =0 if A3032_B>5 & Z1004=="CZE_1996"
replace A2038_2 =0 if A3032_B==5 & Z1004=="CZE_1996"
replace A2038_2 =1 if A3032_B<5  & Z1004=="CZE_1996"
replace A2038_2 =0 if A3032_B==.  & Z1004=="CZE_1996"
*tab A2038_2 if Z1004=="CZE_1996"

replace A2038_3 =0 if A3032_C>5 & Z1004=="CZE_1996"
replace A2038_3 =0 if A3032_C==5 & Z1004=="CZE_1996"
replace A2038_3 =1 if A3032_C<5  & Z1004=="CZE_1996"
replace A2038_3 =0 if A3032_C==.  & Z1004=="CZE_1996"
*tab A2038_3 if Z1004=="CZE_1996"
*list A3032_C A2038_3 if Z1004=="CZE_1996"

replace A2038_4 =0 if A3032_D<5 & Z1004=="CZE_1996"
replace A2038_4 =0 if A3032_D==5 & Z1004=="CZE_1996"
replace A2038_4 =1 if A3032_D>5  & Z1004=="CZE_1996"
replace A2038_4 =0 if A3032_D==.  & Z1004=="CZE_1996"
*list A3032_D A2038_4 if Z1004=="CZE_1996"
*tab A2038_4 if Z1004=="CZE_1996"

replace A2038_5 =0 if A3032_E<5 & Z1004=="CZE_1996"
replace A2038_5 =0 if A3032_E==5 & Z1004=="CZE_1996"
replace A2038_5 =1 if A3032_E>5  & Z1004=="CZE_1996"
replace A2038_5 =0 if A3032_E==.  & Z1004=="CZE_1996"
*list A3032_E A2038_5 if Z1004=="CZE_1996"
*tab A2038_5 if Z1004=="CZE_1996"

replace A2038_6 =0 if A3032_F<5 & Z1004=="CZE_1996"
replace A2038_6 =0 if A3032_F==5 & Z1004=="CZE_1996"
replace A2038_6 =1 if A3032_F>5  & Z1004=="CZE_1996"
replace A2038_6 =0 if A3032_F==.  & Z1004=="CZE_1996"
*list A3032_F A2038_6 if Z1004=="CZE_1996"
*tab A2038_6 if Z1004=="CZE_1996"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="CZE_1996"
*tab A2038 if Z1004=="CZE_1996"

**version iii

sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="CZE_1996"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="CZE_1996"

**Party A
replace A2039_1 = A5004_A-A3032_A if Z1004=="CZE_1996"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="CZE_1996"
*tab  A2039_1 if Z1004=="CZE_1996"
***missings
sum A3032_A if Z1004=="CZE_1996"
replace A2039_1_b = A5004_A-A3032_A if Z1004=="CZE_1996"
replace A2039_1_b= A5004_A-(8.93+1.49) if A3032_A==. & Z1004=="CZE_1996"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="CZE_1996"
*tab  A2039_1_b if Z1004=="CZE_1996"

**Party B
replace A2039_2 = A5004_B-A3032_B if Z1004=="CZE_1996"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="CZE_1996"
*tab  A2039_2 if Z1004=="CZE_1996"
***missings
sum A3032_B if Z1004=="CZE_1996"
replace A2039_2_b = A5004_B-A3032_B if Z1004=="CZE_1996"
replace A2039_2_b= A5004_B-(3.38+1.85) if A3032_B==. & Z1004=="CZE_1996"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="CZE_1996"
*tab  A2039_2_b if Z1004=="CZE_1996"

**Party C
replace A2039_3 = A5004_C-A3032_C if Z1004=="CZE_1996"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="CZE_1996"
*tab  A2039_3 if Z1004=="CZE_1996"
***missings
sum A3032_C if Z1004=="CZE_1996"
replace A2039_3_b = A5004_C-A3032_C if Z1004=="CZE_1996"
replace A2039_3_b= A5004_C-(0.60+1.10) if A3032_C==. & Z1004=="CZE_1996"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="CZE_1996"
*tab  A2039_3_b if Z1004=="CZE_1996"

**Party D
replace A2039_4 = A5004_D-A3032_D if Z1004=="CZE_1996"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="CZE_1996"
*tab  A2039_4 if Z1004=="CZE_1996"
***missings
sum A3032_D if Z1004=="CZE_1996"
replace A2039_4_b = A5004_D-A3032_D if Z1004=="CZE_1996"
replace A2039_4_b= A5004_D-(6.20+1.74) if A3032_D==. & Z1004=="CZE_1996"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="CZE_1996"
*tab  A2039_4_b if Z1004=="CZE_1996"

**Party E
replace A2039_5 = A5004_E-A3032_E if Z1004=="CZE_1996"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="CZE_1996"
*tab  A2039_5 if Z1004=="CZE_1996"
***missings
sum A3032_E if Z1004=="CZE_1996"
replace A2039_5_b = A5004_E-A3032_E if Z1004=="CZE_1996"
replace A2039_5_b= A5004_E-(5.93+3.34) if A3032_E==. & Z1004=="CZE_1996"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="CZE_1996"
*tab  A2039_5_b if Z1004=="CZE_1996"

**Party F
replace A2039_6 = A5004_F-A3032_F if Z1004=="CZE_1996"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="CZE_1996"
*tab  A2039_6 if Z1004=="CZE_1996"
***missings
sum A3032_F if Z1004=="CZE_1996"
replace A2039_6_b = A5004_F-A3032_F if Z1004=="CZE_1996"
replace A2039_6_b= A5004_F-(7.38+1.82) if A3032_F==. & Z1004=="CZE_1996"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="CZE_1996"
*tab  A2039_6_b if Z1004=="CZE_1996"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6)/6 if Z1004=="CZE_1996"
sum  A2039 if Z1004=="CZE_1996"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b)/6 if Z1004=="CZE_1996"
sum  A2039_B if Z1004=="CZE_1996"


****************************************************************************************
**CZE_2002 
**
*tab B5018_A if Z1004=="CZE_2002" 
*tab B5018_B if Z1004=="CZE_2002" 
*tab B5018_C if Z1004=="CZE_2002" 
*tab B5018_D if Z1004=="CZE_2002" 
*tab B5018_E if Z1004=="CZE_2002" 

*tab B3038_A if Z1004=="CZE_2002"
*tab B3038_B if Z1004=="CZE_2002"
*tab B3038_C if Z1004=="CZE_2002"
*tab B3038_D if Z1004=="CZE_2002"
*tab B3038_E if Z1004=="CZE_2002"

mvdecode B3038_A, mv(99, 96, 98), if Z1004=="CZE_2002"
mvdecode B3038_B, mv(99, 96, 98), if Z1004=="CZE_2002"
mvdecode B3038_C, mv(99, 96, 98), if Z1004=="CZE_2002"
mvdecode B3038_D, mv(99, 96, 98), if Z1004=="CZE_2002"
mvdecode B3038_E, mv(99, 96, 98), if Z1004=="CZE_2002"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*5 parties (so 5-4) to most left to most right?
*  CADEB
replace A2037_1 =1 if B3038_C< B3038_A & Z1004=="CZE_2002"
replace A2037_1 =0 if B3038_C> B3038_A & Z1004=="CZE_2002"
replace A2037_1 =0 if B3038_C == B3038_A & Z1004=="CZE_2002"
replace A2037_1 =0 if B3038_C ==. & Z1004=="CZE_2002"
replace A2037_1 =0 if B3038_A ==. & Z1004=="CZE_2002"
*list A2037_1 B3038_C B3038_D if Z1004=="CZE_2002"
*tab A2037_1 if Z1004=="CZE_2002", miss

replace A2037_2 =1 if B3038_A< B3038_D & Z1004=="CZE_2002"
replace A2037_2 =0 if B3038_A> B3038_D & Z1004=="CZE_2002"
replace A2037_2 =0 if B3038_A == B3038_D & Z1004=="CZE_2002"
replace A2037_2 =0 if B3038_A ==. & Z1004=="CZE_2002"
replace A2037_2 =0 if B3038_D ==. & Z1004=="CZE_2002"
*list A2037_2 B3038_D B3038_A if Z1004=="CZE_2002"
*tab A2037_2 if Z1004=="CZE_2002"

replace A2037_3 =1 if B3038_D< B3038_E & Z1004=="CZE_2002"
replace A2037_3 =0 if B3038_D> B3038_E & Z1004=="CZE_2002"
replace A2037_3 =0 if B3038_D == B3038_E & Z1004=="CZE_2002"
replace A2037_3 =0 if B3038_D ==. & Z1004=="CZE_2002"
replace A2037_3 =0 if B3038_E ==. & Z1004=="CZE_2002"
*list A2037_3 B3038_D B3038_E if Z1004=="CZE_2002"
*tab A2037_3 if Z1004=="CZE_2002"

replace A2037_4 =1 if B3038_E< B3038_B & Z1004=="CZE_2002"
replace A2037_4 =0 if B3038_E> B3038_B & Z1004=="CZE_2002"
replace A2037_4 =0 if B3038_E == B3038_B & Z1004=="CZE_2002" 
replace A2037_4 =0 if B3038_B & B3038_C==. & Z1004=="CZE_2002"
*list A2037_4 B3038_E B3038_B if Z1004=="CZE_2002" 
*tab A2037_4 if Z1004=="CZE_2002"

replace A2037_5 =1 if B3038_C< B3038_B & Z1004=="CZE_2002"
replace A2037_5 =0 if B3038_C> B3038_B & Z1004=="CZE_2002"
replace A2037_5 =0 if B3038_C == B3038_B & Z1004=="CZE_2002"
*list A2037_5 B3038_C B3038_B if Z1004=="CZE_2002"
*tab A2037_5 if Z1004=="CZE_2002", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="CZE_2002"
*tab A2037  if Z1004=="CZE_2002"

*)correct placement of parties on the left-right is following the 
*5 parties
replace A2038_1 =0 if B3038_A>5 & Z1004=="CZE_2002"
replace A2038_1 =0 if B3038_A==5 & Z1004=="CZE_2002"
replace A2038_1 =1 if B3038_A<5  & Z1004=="CZE_2002"
replace A2038_1 =0 if B3038_A==.  & Z1004=="CZE_2002"
*tab A2038_1 if Z1004=="CZE_2002"

replace A2038_2 =1 if B3038_B>5 & Z1004=="CZE_2002"
replace A2038_2 =0 if B3038_B==5 & Z1004=="CZE_2002"
replace A2038_2 =0 if B3038_B<5  & Z1004=="CZE_2002"
replace A2038_2 =0 if B3038_B==.  & Z1004=="CZE_2002"
*list A2038_2 B3038_B if Z1004=="CZE_2002"
*tab A2038_2 if Z1004=="CZE_2002"

replace A2038_3 =1 if B3038_C<5 & Z1004=="CZE_2002"
replace A2038_3 =0 if B3038_C==5 & Z1004=="CZE_2002"
replace A2038_3 =0 if B3038_C>5  & Z1004=="CZE_2002"
replace A2038_3 =0 if B3038_C==.  & Z1004=="CZE_2002"
*tab A2038_3 if Z1004=="CZE_2002"
*list B3038_C A2038_3 if Z1004=="CZE_2002"

replace A2038_4 =0 if B3038_D<5 & Z1004=="CZE_2002"
replace A2038_4 =1 if B3038_D==5 & Z1004=="CZE_2002"
replace A2038_4 =0 if B3038_D>5  & Z1004=="CZE_2002"
replace A2038_4 =0 if B3038_D==.  & Z1004=="CZE_2002"
*list B3038_D A2038_4 if Z1004=="CZE_2002"
*tab A2038_4 if Z1004=="CZE_2002"

replace A2038_5 =0 if B3038_E<5 & Z1004=="CZE_2002"
replace A2038_5 =0 if B3038_E==5 & Z1004=="CZE_2002"
replace A2038_5 =1 if B3038_E>5  & Z1004=="CZE_2002"
replace A2038_5 =0 if B3038_E==.  & Z1004=="CZE_2002"
*list B3038_E A2038_5 if Z1004=="CZE_2002"
*tab A2038_5 if Z1004=="CZE_2002"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="CZE_2002"
*tab A2038 if Z1004=="CZE_2002"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="CZE_2002"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="CZE_2002"
*tab  A2039_1 if Z1004=="CZE_2002"
***missings
sum B3038_A if Z1004=="CZE_2002"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="CZE_2002"
replace A2039_1_b= B5018_A-(2.69+1.68) if B3038_A==. & Z1004=="CZE_2002"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="CZE_2002"
*tab  A2039_1_b if Z1004=="CZE_2002"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="CZE_2002"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="CZE_2002"
*tab  A2039_2 if Z1004=="CZE_2002"
***missings
sum B3038_B if Z1004=="CZE_2002"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="CZE_2002"
replace A2039_2_b= B5018_B-(8.24+1.85) if B3038_B==. & Z1004=="CZE_2002"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="CZE_2002"
*tab  A2039_2_b if Z1004=="CZE_2002"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="CZE_2002"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="CZE_2002"
*tab  A2039_3 if Z1004=="CZE_2002"
***missings
sum B3038_C if Z1004=="CZE_2002"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="CZE_2002"
replace A2039_3_b= B5018_C-(0.77+1.8) if B3038_C==. & Z1004=="CZE_2002"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="CZE_2002"
*tab  A2039_3_b if Z1004=="CZE_2002"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="CZE_2002"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="CZE_2002"
*tab  A2039_4 if Z1004=="CZE_2002"
***missings
sum B3038_D if Z1004=="CZE_2002"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="CZE_2002"
replace A2039_4_b= B5018_D-(5.74+2) if B3038_D==. & Z1004=="CZE_2002"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="CZE_2002"
*tab  A2039_4_b if Z1004=="CZE_2002"

**Party E
replace A2039_5 = B5018_E-B3038_E if Z1004=="CZE_2002"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="CZE_2002"
*tab  A2039_5 if Z1004=="CZE_2002"
***missings
sum B3038_E if Z1004=="CZE_2002"
replace A2039_5_b = B5018_E-B3038_E if Z1004=="CZE_2002"
replace A2039_5_b= B5018_E-(6.92+1.9) if B3038_E==. & Z1004=="CZE_2002"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="CZE_2002"
*tab  A2039_5_b if Z1004=="CZE_2002"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5)/5 if Z1004=="CZE_2002"
sum  A2039 if Z1004=="CZE_2002"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b)/5 if Z1004=="CZE_2002"
sum  A2039_B if Z1004=="CZE_2002"


****************************************************************************************
***CZE_2006
*tab C5017_A if Z1004=="CZE_2006" 
*tab C5017_B if Z1004=="CZE_2006" 
*tab C5017_C if Z1004=="CZE_2006" 
*tab C5017_D if Z1004=="CZE_2006" 
*tab C5017_E if Z1004=="CZE_2006"  


*tab C3011_A if Z1004=="CZE_2006", mis
*tab C3011_B if Z1004=="CZE_2006", mis
*tab C3011_C if Z1004=="CZE_2006", mis
*tab C3011_D if Z1004=="CZE_2006", mis
*tab C3011_E if Z1004=="CZE_2006", mis



**MISSING IS REALLY MISSING HERE BECAUSE OF THE SAMPLING
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2006"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2006"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2006"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2006"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2006"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2006"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2006"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2006"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2006"



**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*5 parties 
** CBDEA (D=E)
replace A2037_1 =1 if C3011_C< C3011_B & Z1004=="CZE_2006"
replace A2037_1 =0 if C3011_C> C3011_B & Z1004=="CZE_2006"
replace A2037_1 =0 if C3011_C == C3011_B & Z1004=="CZE_2006"
replace A2037_1 =0 if C3011_C ==. & Z1004=="CZE_2006"
replace A2037_1 =0 if C3011_B ==. & Z1004=="CZE_2006"
*list A2037_1 C3011_E C3011_C if Z1004=="CZE_2006"
*tab A2037_1 if Z1004=="CZE_2006", miss

replace A2037_2 =1 if C3011_B< C3011_D & Z1004=="CZE_2006"
replace A2037_2 =0 if C3011_B> C3011_D & Z1004=="CZE_2006"
replace A2037_2 =0 if C3011_B == C3011_D & Z1004=="CZE_2006"
replace A2037_2 =0 if C3011_B ==. & Z1004=="CZE_2006"
replace A2037_2 =0 if C3011_D ==. & Z1004=="CZE_2006"
*list A2037_2 C3011_D C3011_B if Z1004=="CZE_2006"
*tab A2037_2 if Z1004=="CZE_2006", miss

replace A2037_3 =0 if C3011_D< C3011_E & Z1004=="CZE_2006"
replace A2037_3 =0 if C3011_D> C3011_E & Z1004=="CZE_2006"
replace A2037_3 =1 if C3011_D == C3011_E & Z1004=="CZE_2006"
replace A2037_3 =0 if C3011_D ==. & Z1004=="CZE_2006"
replace A2037_3 =0 if C3011_E ==. & Z1004=="CZE_2006"
*list A2037_3 C3011_C C3011_D if Z1004=="CZE_2006"
*tab A2037_3 if Z1004=="CZE_2006", miss

replace A2037_4 =1 if C3011_E< C3011_A & Z1004=="CZE_2006"
replace A2037_4 =0 if C3011_E> C3011_A & Z1004=="CZE_2006"
replace A2037_4 =0 if C3011_E == C3011_A & Z1004=="CZE_2006"
replace A2037_4 =0 if C3011_E ==. & Z1004=="CZE_2006"
replace A2037_4 =0 if C3011_A ==. & Z1004=="CZE_2006"
*list A2037_4 C3011_F C3011_G if Z1004=="CZE_2006"
*tab A2037_4 if Z1004=="CZE_2006"

replace A2037_5 =1 if C3011_C< C3011_A & Z1004=="CZE_2006"
replace A2037_5 =0 if C3011_C> C3011_A & Z1004=="CZE_2006"
replace A2037_5 =0 if C3011_C == C3011_A & Z1004=="CZE_2006"
replace A2037_5 =0 if C3011_C ==. & Z1004=="CZE_2006"
replace A2037_5 =0 if C3011_A ==. & Z1004=="CZE_2006"
*list A2037_1 C3011_D C3011_C if Z1004=="CZE_2006"
*tab A2037_1 if Z1004=="CZE_2006", miss

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="CZE_2006"
*tab A2037 if Z1004=="CZE_2006"

*ii)correct placement of parties on the left-right is following the 
*4 parties
replace A2038_1 =0 if C3011_A<5 & Z1004=="CZE_2006"
replace A2038_1 =0 if C3011_A==5 & Z1004=="CZE_2006"
replace A2038_1 =1 if C3011_A>5  & Z1004=="CZE_2006"
replace A2038_1 =0 if C3011_A==.  & Z1004=="CZE_2006"
*tab A2038_1 if Z1004=="CZE_2006"

replace A2038_2 =0 if C3011_B>5 & Z1004=="CZE_2006"
replace A2038_2 =0 if C3011_B==5 & Z1004=="CZE_2006"
replace A2038_2 =1 if C3011_B<5  & Z1004=="CZE_2006"
replace A2038_2 =0 if C3011_B==.  & Z1004=="CZE_2006"
*list A2038_2 C3011_B if Z1004=="CZE_2006"
*tab A2038_2 if Z1004=="CZE_2006"

replace A2038_3 =0 if C3011_C>5 & Z1004=="CZE_2006"
replace A2038_3 =0 if C3011_C==5 & Z1004=="CZE_2006"
replace A2038_3 =1 if C3011_C<5  & Z1004=="CZE_2006"
replace A2038_3 =0 if C3011_C==.  & Z1004=="CZE_2006"
*tab A2038_3 if Z1004=="CZE_2006"
*list C3011_C A2038_3 if Z1004=="CZE_2006"

replace A2038_4 =0 if C3011_D<5 & Z1004=="CZE_2006"
replace A2038_4 =1 if C3011_D==5 & Z1004=="CZE_2006"
replace A2038_4 =0 if C3011_D>5  & Z1004=="CZE_2006"
replace A2038_4 =0 if C3011_D==.  & Z1004=="CZE_2006"
*list C3011_D A2038_4 if Z1004=="CZE_2006"
*tab A2038_4 if Z1004=="CZE_2006"

replace A2038_5 =0 if C3011_E<5 & Z1004=="CZE_2006"
replace A2038_5 =1 if C3011_E==5 & Z1004=="CZE_2006"
replace A2038_5 =0 if C3011_E>5  & Z1004=="CZE_2006"
replace A2038_5 =0 if C3011_E==.  & Z1004=="CZE_2006"
*list C3011_E A2038_4 if Z1004=="CZE_2006"
*tab A2038_4 if Z1004=="CZE_2006"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="CZE_2006"
*tab A2038 if Z1004=="CZE_2006"

**version iii

**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="CZE_2006"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="CZE_2006"
*tab  A2039_1 if Z1004=="CZE_2006"
***missings
sum C3011_A if Z1004=="CZE_2006"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="CZE_2006"
replace A2039_1_b= C5017_A-(8.8+1.7) if C3011_A==. & Z1004=="CZE_2006"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="CZE_2006"
*tab  A2039_1_b if Z1004=="CZE_2006"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="CZE_2006"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="CZE_2006"
*tab  A2039_2 if Z1004=="CZE_2006"
***missings
sum C3011_B if Z1004=="CZE_2006"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="CZE_2006"
replace A2039_2_b= C5017_B-(2.9+1.7) if C3011_B==. & Z1004=="CZE_2006"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="CZE_2006"
*tab  A2039_2_b if Z1004=="CZE_2006"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="CZE_2006"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="CZE_2006"
*tab  A2039_3 if Z1004=="CZE_2006"
***missings
sum C3011_C if Z1004=="CZE_2006"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="CZE_2006"
replace A2039_3_b= C5017_C-(1+1.46) if C3011_C==. & Z1004=="CZE_2006"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="CZE_2006"
*tab  A2039_3_b if Z1004=="CZE_2006"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="CZE_2006"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="CZE_2006"
*tab  A2039_4 if Z1004=="CZE_2006"
***missings
sum C3011_E if Z1004=="CZE_2006"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="CZE_2006"
replace A2039_4_b= C5017_E-(6.2+1.76) if C3011_E==. & Z1004=="CZE_2006"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="CZE_2006"
*tab  A2039_4_b if Z1004=="CZE_2006"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="CZE_2006"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="CZE_2006"
*tab  A2039_5 if Z1004=="CZE_2006"
***missings
sum C3011_D if Z1004=="CZE_2006"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="CZE_2006"
replace A2039_5_b= C5017_D-(6.1+1.9) if C3011_D==. & Z1004=="CZE_2006"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="CZE_2006"
*tab  A2039_5_b if Z1004=="CZE_2006"



**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5)/5 if Z1004=="CZE_2006"
**tab  A2039 if Z1004=="CZE_2006"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b)/5 if Z1004=="CZE_2006"
**tab  A2039_B if Z1004=="CZE_2006"


****************************************************************************************
***CZE_2010
*tab C5017_A if Z1004=="CZE_2010" 
*tab C5017_B if Z1004=="CZE_2010" 
*tab C5017_C if Z1004=="CZE_2010" 
*tab C5017_D if Z1004=="CZE_2010" 
*tab C5017_E if Z1004=="CZE_2010"  
*tab C5017_G if Z1004=="CZE_2010"
*tab C5017_H if Z1004=="CZE_2010"  

*tab C3011_A if Z1004=="CZE_2010", mis
*tab C3011_B if Z1004=="CZE_2010", mis
*tab C3011_C if Z1004=="CZE_2010", mis
*tab C3011_D if Z1004=="CZE_2010", mis
*tab C3011_E if Z1004=="CZE_2010", mis
*tab C3011_G if Z1004=="CZE_2010", mis
*tab C3011_H if Z1004=="CZE_2010", mis


**MISSING IS REALLY MISSING HERE BECAUSE OF THE SAMPLING
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2010"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2010"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2010"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2010"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2010"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2010"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2010"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2010"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="CZE_2010"



**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*6 parties 
** DAEHBC (E=H)
replace A2037_1 =1 if C3011_D< C3011_A & Z1004=="CZE_2010"
replace A2037_1 =0 if C3011_D> C3011_A & Z1004=="CZE_2010"
replace A2037_1 =0 if C3011_D == C3011_A & Z1004=="CZE_2010"
replace A2037_1 =0 if C3011_D ==. & Z1004=="CZE_2010"
replace A2037_1 =0 if C3011_A ==. & Z1004=="CZE_2010"
*list A2037_1 C3011_D C3011_A if Z1004=="CZE_2010"
*tab A2037_1 if Z1004=="CZE_2010", miss

replace A2037_2 =1 if C3011_A< C3011_E & Z1004=="CZE_2010"
replace A2037_2 =0 if C3011_A> C3011_E & Z1004=="CZE_2010"
replace A2037_2 =0 if C3011_A == C3011_E & Z1004=="CZE_2010"
replace A2037_2 =0 if C3011_A ==. & Z1004=="CZE_2010"
replace A2037_2 =0 if C3011_E ==. & Z1004=="CZE_2010"
*list A2037_2 C3011_A C3011_G if Z1004=="CZE_2010"
*tab A2037_2 if Z1004=="CZE_2010", miss

replace A2037_3 =0 if C3011_H< C3011_E & Z1004=="CZE_2010"
replace A2037_3 =0 if C3011_H> C3011_E & Z1004=="CZE_2010"
replace A2037_3 =1 if C3011_H == C3011_E & Z1004=="CZE_2010"
replace A2037_3 =0 if C3011_H ==. & Z1004=="CZE_2010"
replace A2037_3 =0 if C3011_E ==. & Z1004=="CZE_2010"
*list A2037_3 C3011_G C3011_E if Z1004=="CZE_2010"
*tab A2037_3 if Z1004=="CZE_2010", miss

replace A2037_4 =1 if C3011_E< C3011_B & Z1004=="CZE_2010"
replace A2037_4 =0 if C3011_E> C3011_B & Z1004=="CZE_2010"
replace A2037_4 =0 if C3011_E == C3011_B & Z1004=="CZE_2010"
replace A2037_4 =0 if C3011_E ==. & Z1004=="CZE_2010"
replace A2037_4 =0 if C3011_B ==. & Z1004=="CZE_2010"
*list A2037_4 C3011_E C3011_B if Z1004=="CZE_2010"
*tab A2037_4 if Z1004=="CZE_2010"

replace A2037_5 =1 if C3011_B< C3011_C & Z1004=="CZE_2010"
replace A2037_5 =0 if C3011_B> C3011_C & Z1004=="CZE_2010"
replace A2037_5 =0 if C3011_B == C3011_C & Z1004=="CZE_2010"
replace A2037_5 =0 if C3011_B ==. & Z1004=="CZE_2010"
replace A2037_5 =0 if C3011_C ==. & Z1004=="CZE_2010"
*list A2037_1 C3011_B C3011_C if Z1004=="CZE_2010"
*tab A2037_5 if Z1004=="CZE_2010", miss

replace A2037_6 =1 if C3011_D< C3011_C & Z1004=="CZE_2010"
replace A2037_6 =0 if C3011_D> C3011_C & Z1004=="CZE_2010"
replace A2037_6 =0 if C3011_D == C3011_C & Z1004=="CZE_2010"
replace A2037_6 =0 if C3011_D ==. & Z1004=="CZE_2010"
replace A2037_6 =0 if C3011_C ==. & Z1004=="CZE_2010"
*list A2037_1 C3011_B C3011_C if Z1004=="CZE_2010"
*tab A2037_6 if Z1004=="CZE_2010", miss


***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="CZE_2010"
*tab A2037 if Z1004=="CZE_2010"

*ii)correct placement of parties on the left-right is following the 
*4 parties
replace A2038_1 =1 if C3011_A<5 & Z1004=="CZE_2010"
replace A2038_1 =0 if C3011_A==5 & Z1004=="CZE_2010"
replace A2038_1 =0 if C3011_A>5  & Z1004=="CZE_2010"
replace A2038_1 =0 if C3011_A==.  & Z1004=="CZE_2010"
*tab A2038_1 if Z1004=="CZE_2010"

replace A2038_2 =1 if C3011_B>5 & Z1004=="CZE_2010"
replace A2038_2 =0 if C3011_B==5 & Z1004=="CZE_2010"
replace A2038_2 =0 if C3011_B<5  & Z1004=="CZE_2010"
replace A2038_2 =0 if C3011_B==.  & Z1004=="CZE_2010"
*list A2038_2 C3011_B if Z1004=="CZE_2010"
*tab A2038_2 if Z1004=="CZE_2010"

replace A2038_3 =1 if C3011_C>5 & Z1004=="CZE_2010"
replace A2038_3 =0 if C3011_C==5 & Z1004=="CZE_2010"
replace A2038_3 =0 if C3011_C<5  & Z1004=="CZE_2010"
replace A2038_3 =0 if C3011_C==.  & Z1004=="CZE_2010"
*tab A2038_3 if Z1004=="CZE_2010"
*list C3011_C A2038_3 if Z1004=="CZE_2010"

replace A2038_4 =1 if C3011_D<5 & Z1004=="CZE_2010"
replace A2038_4 =0 if C3011_D==5 & Z1004=="CZE_2010"
replace A2038_4 =0 if C3011_D>5  & Z1004=="CZE_2010"
replace A2038_4 =0 if C3011_D==.  & Z1004=="CZE_2010"
*list C3011_D A2038_4 if Z1004=="CZE_2010"
*tab A2038_4 if Z1004=="CZE_2010"

replace A2038_5 =0 if C3011_E<5 & Z1004=="CZE_2010"
replace A2038_5 =0 if C3011_E==5 & Z1004=="CZE_2010"
replace A2038_5 =1 if C3011_E>5  & Z1004=="CZE_2010"
replace A2038_5 =0 if C3011_E==.  & Z1004=="CZE_2010"
*list C3011_E A2038_4 if Z1004=="CZE_2010"
*tab A2038_5 if Z1004=="CZE_2010"


replace A2038_6 =1 if C3011_H>5 & Z1004=="CZE_2010"
replace A2038_6 =0 if C3011_H==5 & Z1004=="CZE_2010"
replace A2038_6 =0 if C3011_H<5  & Z1004=="CZE_2010"
replace A2038_6 =0 if C3011_H==.  & Z1004=="CZE_2010"
*list C3011_H A2038_5 if Z1004=="CZE_2010"
*tab A2038_6 if Z1004=="CZE_2010"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="CZE_2010"
*tab A2038 if Z1004=="CZE_2010"

**version iii

**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="CZE_2010"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="CZE_2010"
*tab  A2039_1 if Z1004=="CZE_2010"
***missings
sum C3011_A if Z1004=="CZE_2010"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="CZE_2010"
replace A2039_1_b= C5017_A-(2.66+2) if C3011_A==. & Z1004=="CZE_2010"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="CZE_2010"
*tab  A2039_1_b if Z1004=="CZE_2010"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="CZE_2010"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="CZE_2010"
*tab  A2039_2 if Z1004=="CZE_2010"
***missings
sum C3011_B if Z1004=="CZE_2010"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="CZE_2010"
replace A2039_2_b= C5017_B-(8.2+2) if C3011_B==. & Z1004=="CZE_2010"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="CZE_2010"
*tab  A2039_2_b if Z1004=="CZE_2010"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="CZE_2010"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="CZE_2010"
*tab  A2039_3 if Z1004=="CZE_2010"
***missings
sum C3011_C if Z1004=="CZE_2010"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="CZE_2010"
replace A2039_3_b= C5017_C-(7.89+2) if C3011_C==. & Z1004=="CZE_2010"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="CZE_2010"
*tab  A2039_3_b if Z1004=="CZE_2010"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="CZE_2010"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="CZE_2010"
*tab  A2039_4 if Z1004=="CZE_2010"
***missings
sum C3011_E if Z1004=="CZE_2010"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="CZE_2010"
replace A2039_4_b= C5017_E-(6.7+1.95) if C3011_E==. & Z1004=="CZE_2010"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="CZE_2010"
*tab  A2039_4_b if Z1004=="CZE_2010"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="CZE_2010"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="CZE_2010"
*tab  A2039_5 if Z1004=="CZE_2010"
***missings
sum C3011_D if Z1004=="CZE_2010"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="CZE_2010"
replace A2039_5_b= C5017_D-(1.21+1.79) if C3011_D==. & Z1004=="CZE_2010"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="CZE_2010"
*tab  A2039_5_b if Z1004=="CZE_2010"

*Party H
replace A2039_6 = C5017_H-C3011_H if Z1004=="CZE_2010"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="CZE_2010"
*tab  A2039_6 if Z1004=="CZE_2010"
***missings
sum C3011_H if Z1004=="CZE_2010"
replace A2039_6_b = C5017_H-C3011_H if Z1004=="CZE_2010"
replace A2039_6_b= C5017_H-(5.63+1.78) if C3011_H==. & Z1004=="CZE_2010"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="CZE_2010"
*tab  A2039_6_b if Z1004=="CZE_2010"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6)/6 if Z1004=="CZE_2010"
**tab  A2039 if Z1004=="CZE_2010"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b)/6 if Z1004=="CZE_2010"
**tab  A2039_B if Z1004=="CZE_2010"



****************************************************************************************
***FIN_2003

*tab B5018_A if Z1004=="FIN_2003" 
*tab B5018_B if Z1004=="FIN_2003" 
*tab B5018_C if Z1004=="FIN_2003" 
*tab B5018_D if Z1004=="FIN_2003" 
*tab B5018_E if Z1004=="FIN_2003" 
*tab B5018_F if Z1004=="FIN_2003" 
*tab B5018_G if Z1004=="FIN_2003" 

*tab B3038_A if Z1004=="FIN_2003"
*tab B3038_B if Z1004=="FIN_2003"
*tab B3038_C if Z1004=="FIN_2003"
*tab B3038_D if Z1004=="FIN_2003"
*tab B3038_E if Z1004=="FIN_2003"
*tab B3038_F if Z1004=="FIN_2003"
*tab B3038_G if Z1004=="FIN_2003"

mvdecode B3038_A, mv(99, 96, 98), if Z1004=="FIN_2003"
mvdecode B3038_B, mv(99, 96, 98), if Z1004=="FIN_2003"
mvdecode B3038_C, mv(99, 96, 98), if Z1004=="FIN_2003"
mvdecode B3038_D, mv(99, 96, 98), if Z1004=="FIN_2003"
mvdecode B3038_E, mv(99, 96, 98), if Z1004=="FIN_2003"
mvdecode B3038_F, mv(99, 96, 98), if Z1004=="FIN_2003"
mvdecode B3038_G, mv(99, 96, 98), if Z1004=="FIN_2003"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*7 parties 
*  DBEFAGC
replace A2037_1 =1 if B3038_D< B3038_B & Z1004=="FIN_2003"
replace A2037_1 =0 if B3038_D> B3038_B & Z1004=="FIN_2003"
replace A2037_1 =0 if B3038_D == B3038_B & Z1004=="FIN_2003"
replace A2037_1 =0 if B3038_D ==. & Z1004=="FIN_2003"
replace A2037_1 =0 if B3038_B ==. & Z1004=="FIN_2003"
*list A2037_1 B3038_D B3038_B if Z1004=="FIN_2003"
*tab A2037_1 if Z1004=="FIN_2003", miss

replace A2037_2 =0 if B3038_B< B3038_E & Z1004=="FIN_2003"
replace A2037_2 =0 if B3038_B> B3038_E & Z1004=="FIN_2003"
replace A2037_2 =1 if B3038_B == B3038_E & Z1004=="FIN_2003"
replace A2037_2 =0 if B3038_B ==. & Z1004=="FIN_2003"
replace A2037_2 =0 if B3038_E ==. & Z1004=="FIN_2003"
*list A2037_2 B3038_B B3038_E if Z1004=="FIN_2003"
*tab A2037_2 if Z1004=="FIN_2003"

replace A2037_3 =1 if B3038_E< B3038_F & Z1004=="FIN_2003"
replace A2037_3 =0 if B3038_E> B3038_F & Z1004=="FIN_2003"
replace A2037_3 =0 if B3038_E == B3038_F & Z1004=="FIN_2003"
replace A2037_3 =0 if B3038_E ==. & Z1004=="FIN_2003"
replace A2037_3 =0 if B3038_F ==. & Z1004=="FIN_2003"
*list A2037_3 B3038_F B3038_E if Z1004=="FIN_2003"
*tab A2037_3 if Z1004=="FIN_2003"

replace A2037_4 =1 if B3038_F< B3038_A & Z1004=="FIN_2003"
replace A2037_4 =0 if B3038_F> B3038_A & Z1004=="FIN_2003"
replace A2037_4 =0 if B3038_F == B3038_A & Z1004=="FIN_2003" 
replace A2037_4 =0 if B3038_F & B3038_A==. & Z1004=="FIN_2003"
*list A2037_4 B3038_F B3038_A if Z1004=="FIN_2003" 
*tab A2037_4 if Z1004=="FIN_2003"

replace A2037_5 =1 if B3038_A< B3038_G & Z1004=="FIN_2003"
replace A2037_5 =0 if B3038_A> B3038_G & Z1004=="FIN_2003"
replace A2037_5 =0 if B3038_A == B3038_G & Z1004=="FIN_2003"
replace A2037_3 =0 if B3038_A ==. & Z1004=="FIN_2003"
replace A2037_3 =0 if B3038_G ==. & Z1004=="FIN_2003"
*list A2037_5 B3038_C B3038_B if Z1004=="FIN_2003"
*tab A2037_5 if Z1004=="FIN_2003", missing

replace A2037_6 =1 if B3038_G< B3038_C & Z1004=="FIN_2003"
replace A2037_6 =0 if B3038_G> B3038_C & Z1004=="FIN_2003"
replace A2037_6 =0 if B3038_G == B3038_C & Z1004=="FIN_2003"
replace A2037_6 =0 if B3038_G ==. & Z1004=="FIN_2003"
replace A2037_6 =0 if B3038_C ==. & Z1004=="FIN_2003"
*list A2037_6 B3038_G B3038_C if Z1004=="FIN_2003"
*tab A2037_6 if Z1004=="FIN_2003", missing

replace A2037_7 =1 if B3038_D< B3038_C & Z1004=="FIN_2003"
replace A2037_7 =0 if B3038_D> B3038_C & Z1004=="FIN_2003"
replace A2037_7 =0 if B3038_D == B3038_C & Z1004=="FIN_2003"
replace A2037_7 =0 if B3038_D ==. & Z1004=="FIN_2003"
replace A2037_7 =0 if B3038_C ==. & Z1004=="FIN_2003"
*list A2037_7 B3038_C B3038_B if Z1004=="FIN_2003"
*tab A2037_7 if Z1004=="FIN_2003", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7)/7 if Z1004=="FIN_2003"
*tab A2037  if Z1004=="FIN_2003"

*)correct placement of parties on the left-right is following the 
*5 parties
replace A2038_1 =1 if B3038_A>5 & Z1004=="FIN_2003"
replace A2038_1 =0 if B3038_A==5 & Z1004=="FIN_2003"
replace A2038_1 =0 if B3038_A<5  & Z1004=="FIN_2003"
replace A2038_1 =0 if B3038_A==.  & Z1004=="FIN_2003"
*tab A2038_1 if Z1004=="FIN_2003"

replace A2038_2 =0 if B3038_B>5 & Z1004=="FIN_2003"
replace A2038_2 =0 if B3038_B==5 & Z1004=="FIN_2003"
replace A2038_2 =1 if B3038_B<5  & Z1004=="FIN_2003"
replace A2038_2 =0 if B3038_B==.  & Z1004=="FIN_2003"
*list A2038_2 B3038_B if Z1004=="FIN_2003"
*tab A2038_2 if Z1004=="FIN_2003"

replace A2038_3 =0 if B3038_C<5 & Z1004=="FIN_2003"
replace A2038_3 =0 if B3038_C==5 & Z1004=="FIN_2003"
replace A2038_3 =1 if B3038_C>5  & Z1004=="FIN_2003"
replace A2038_3 =0 if B3038_C==.  & Z1004=="FIN_2003"
*tab A2038_3 if Z1004=="FIN_2003"
*list B3038_C A2038_3 if Z1004=="FIN_2003"

replace A2038_4 =1 if B3038_D<5 & Z1004=="FIN_2003"
replace A2038_4 =0 if B3038_D==5 & Z1004=="FIN_2003"
replace A2038_4 =0 if B3038_D>5  & Z1004=="FIN_2003"
replace A2038_4 =0 if B3038_D==.  & Z1004=="FIN_2003"
*list B3038_D A2038_4 if Z1004=="FIN_2003"
*tab A2038_4 if Z1004=="FIN_2003"

replace A2038_5 =1 if B3038_E<5 & Z1004=="FIN_2003"
replace A2038_5 =0 if B3038_E==5 & Z1004=="FIN_2003"
replace A2038_5 =0 if B3038_E>5  & Z1004=="FIN_2003"
replace A2038_5 =0 if B3038_E==.  & Z1004=="FIN_2003"
*list B3038_E A2038_5 if Z1004=="FIN_2003"
*tab A2038_5 if Z1004=="FIN_2003"

replace A2038_6 =0 if B3038_F<5 & Z1004=="FIN_2003"
replace A2038_6 =0 if B3038_F==5 & Z1004=="FIN_2003"
replace A2038_6 =1 if B3038_F>5  & Z1004=="FIN_2003"
replace A2038_6 =0 if B3038_F==.  & Z1004=="FIN_2003"
*list B3038_F A2038_6 if Z1004=="FIN_2003"
*tab A2038_6 if Z1004=="FIN_2003"

replace A2038_7 =0 if B3038_G<5 & Z1004=="FIN_2003"
replace A2038_7 =0 if B3038_G==5 & Z1004=="FIN_2003"
replace A2038_7 =1 if B3038_G>5  & Z1004=="FIN_2003"
replace A2038_7 =0 if B3038_G==.  & Z1004=="FIN_2003"
*list B3038_G A2038_7 if Z1004=="FIN_2003"
*tab A2038_7 if Z1004=="FIN_2003"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7)/7 if Z1004=="FIN_2003"
*tab A2038 if Z1004=="FIN_2003"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="FIN_2003"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="FIN_2003"
*tab  A2039_1 if Z1004=="FIN_2003"
***missings
sum B3038_A if Z1004=="FIN_2003"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="FIN_2003"
replace A2039_1_b= B5018_A-(6.19+1.64) if B3038_A==. & Z1004=="FIN_2003"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="FIN_2003"
*tab  A2039_1_b if Z1004=="FIN_2003"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="FIN_2003"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="FIN_2003"
*tab  A2039_2 if Z1004=="FIN_2003"
***missings
sum B3038_B if Z1004=="FIN_2003"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="FIN_2003"
replace A2039_2_b= B5018_B-(4.73+2) if B3038_B==. & Z1004=="FIN_2003"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="FIN_2003"
*tab  A2039_2_b if Z1004=="FIN_2003"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="FIN_2003"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="FIN_2003"
*tab  A2039_3 if Z1004=="FIN_2003"
***missings
sum B3038_C if Z1004=="FIN_2003"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="FIN_2003"
replace A2039_3_b= B5018_C-(7.46+2.1) if B3038_C==. & Z1004=="FIN_2003"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="FIN_2003"
*tab  A2039_3_b if Z1004=="FIN_2003"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="FIN_2003"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="FIN_2003"
*tab  A2039_4 if Z1004=="FIN_2003"
***missings
sum B3038_D if Z1004=="FIN_2003"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="FIN_2003"
replace A2039_4_b= B5018_D-(2.34+1.8) if B3038_D==. & Z1004=="FIN_2003"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="FIN_2003"
*tab  A2039_4_b if Z1004=="FIN_2003"

**Party E
replace A2039_5 = B5018_E-B3038_E if Z1004=="FIN_2003"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="FIN_2003"
*tab  A2039_5 if Z1004=="FIN_2003"
***missings
sum B3038_E if Z1004=="FIN_2003"
replace A2039_5_b = B5018_E-B3038_E if Z1004=="FIN_2003"
replace A2039_5_b= B5018_E-(4.74+1.67) if B3038_E==. & Z1004=="FIN_2003"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="FIN_2003"
*tab  A2039_5_b if Z1004=="FIN_2003"

**Party F
replace A2039_6 = B5018_F-B3038_F if Z1004=="FIN_2003"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="FIN_2003"
*tab  A2039_6 if Z1004=="FIN_2003"
***missings
sum B3038_F if Z1004=="FIN_2003"
replace A2039_6_b = B5018_F-B3038_F if Z1004=="FIN_2003"
replace A2039_6_b= B5018_F-(5.85+1.91) if B3038_F==. & Z1004=="FIN_2003"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="FIN_2003"
*tab  A2039_6_b if Z1004=="FIN_2003"

**Party G
replace A2039_7 = B5018_G-B3038_G if Z1004=="FIN_2003"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="FIN_2003"
*tab  A2039_7 if Z1004=="FIN_2003"
***missings
sum B3038_G if Z1004=="FIN_2003"
replace A2039_7_b = B5018_G-B3038_G if Z1004=="FIN_2003"
replace A2039_7_b= B5018_G-(6.1+2.17) if B3038_G==. & Z1004=="FIN_2003"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="FIN_2003"
*tab  A2039_7_b if Z1004=="FIN_2003"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7)/7 if Z1004=="FIN_2003"
sum  A2039 if Z1004=="FIN_2003"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b)/7 if Z1004=="FIN_2003"
sum  A2039_B if Z1004=="FIN_2003"


****************************************************************************************
*FIN_2007
*tab C5017_A if Z1004=="FIN_2007" 
*tab C5017_B if Z1004=="FIN_2007" 
*tab C5017_C if Z1004=="FIN_2007" 
*tab C5017_D if Z1004=="FIN_2007" 
*tab C5017_E if Z1004=="FIN_2007"  
*tab C5017_F if Z1004=="FIN_2007" 
*tab C5017_G if Z1004=="FIN_2007"
  

*tab C3011_A if Z1004=="FIN_2007", mis
*tab C3011_B if Z1004=="FIN_2007", mis
*tab C3011_C if Z1004=="FIN_2007", mis
*tab C3011_D if Z1004=="FIN_2007", mis
*tab C3011_E if Z1004=="FIN_2007", mis
*tab C3011_G if Z1004=="FIN_2007", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2007"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2007"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2007"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2007"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2007"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2007"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2007"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2007"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2007"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*7 parties 
** DCEAFGB
replace A2037_1 =1 if C3011_D< C3011_C & Z1004=="FIN_2007"
replace A2037_1 =0 if C3011_D> C3011_C & Z1004=="FIN_2007"
replace A2037_1 =0 if C3011_D == C3011_C & Z1004=="FIN_2007"
replace A2037_1 =0 if C3011_D ==. & Z1004=="FIN_2007"
replace A2037_1 =0 if C3011_C ==. & Z1004=="FIN_2007"
*list A2037_1 C3011_D C3011_C if Z1004=="FIN_2007"
*tab A2037_1 if Z1004=="FIN_2007", miss

replace A2037_2 =1 if C3011_C< C3011_E & Z1004=="FIN_2007"
replace A2037_2 =0 if C3011_C> C3011_E & Z1004=="FIN_2007"
replace A2037_2 =0 if C3011_C == C3011_E & Z1004=="FIN_2007"
replace A2037_2 =0 if C3011_C ==. & Z1004=="FIN_2007"
replace A2037_2 =0 if C3011_E ==. & Z1004=="FIN_2007"
*list A2037_2 C3011_A C3011_G if Z1004=="FIN_2007"
*tab A2037_2 if Z1004=="FIN_2007", miss

replace A2037_3 =1 if C3011_E< C3011_A & Z1004=="FIN_2007"
replace A2037_3 =0 if C3011_E> C3011_A & Z1004=="FIN_2007"
replace A2037_3 =0 if C3011_E == C3011_A & Z1004=="FIN_2007"
replace A2037_3 =0 if C3011_E ==. & Z1004=="FIN_2007"
replace A2037_3 =0 if C3011_A ==. & Z1004=="FIN_2007"
*list A2037_3 C3011_G C3011_E if Z1004=="FIN_2007"
*tab A2037_3 if Z1004=="FIN_2007", miss

replace A2037_4 =1 if C3011_A< C3011_F & Z1004=="FIN_2007"
replace A2037_4 =0 if C3011_A> C3011_F & Z1004=="FIN_2007"
replace A2037_4 =0 if C3011_A == C3011_F & Z1004=="FIN_2007"
replace A2037_4 =0 if C3011_A ==. & Z1004=="FIN_2007"
replace A2037_4 =0 if C3011_F ==. & Z1004=="FIN_2007"
*list A2037_4 C3011_A C3011_F if Z1004=="FIN_2007"
*tab A2037_4 if Z1004=="FIN_2007"

replace A2037_5 =1 if C3011_G< C3011_B & Z1004=="FIN_2007"
replace A2037_5 =0 if C3011_G> C3011_B & Z1004=="FIN_2007"
replace A2037_5 =0 if C3011_G == C3011_B & Z1004=="FIN_2007"
replace A2037_5 =0 if C3011_G ==. & Z1004=="FIN_2007"
replace A2037_5 =0 if C3011_B ==. & Z1004=="FIN_2007"
*list A2037_5 C3011_G C3011_B if Z1004=="FIN_2007"
*tab A2037_5 if Z1004=="FIN_2007", miss

replace A2037_6 =1 if C3011_D< C3011_B & Z1004=="FIN_2007"
replace A2037_6 =0 if C3011_D> C3011_B & Z1004=="FIN_2007"
replace A2037_6 =0 if C3011_D == C3011_B & Z1004=="FIN_2007"
replace A2037_6 =0 if C3011_D ==. & Z1004=="FIN_2007"
replace A2037_6 =0 if C3011_B ==. & Z1004=="FIN_2007"
*list A2037_6 C3011_B C3011_C if Z1004=="FIN_2007"
*tab A2037_6 if Z1004=="FIN_2007", miss

replace A2037_7 =1 if C3011_F< C3011_G & Z1004=="FIN_2007"
replace A2037_7 =0 if C3011_F> C3011_G & Z1004=="FIN_2007"
replace A2037_7 =0 if C3011_F == C3011_G & Z1004=="FIN_2007"
replace A2037_7 =0 if C3011_F ==. & Z1004=="FIN_2007"
replace A2037_7 =0 if C3011_G ==. & Z1004=="FIN_2007"
*list A2037_7 C3011_F C3011_G if Z1004=="FIN_2007"
*tab A2037_7 if Z1004=="FIN_2007", miss

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7)/7 if Z1004=="FIN_2007"
*tab A2037 if Z1004=="FIN_2007"

*ii)correct placement of parties on the left-right is following the 
*4 parties
replace A2038_1 =0 if C3011_A<5 & Z1004=="FIN_2007"
replace A2038_1 =1 if C3011_A==5 & Z1004=="FIN_2007"
replace A2038_1 =0 if C3011_A>5  & Z1004=="FIN_2007"
replace A2038_1 =0 if C3011_A==.  & Z1004=="FIN_2007"
*tab A2038_1 if Z1004=="FIN_2007"

replace A2038_2 =1 if C3011_B>5 & Z1004=="FIN_2007"
replace A2038_2 =0 if C3011_B==5 & Z1004=="FIN_2007"
replace A2038_2 =0 if C3011_B<5  & Z1004=="FIN_2007"
replace A2038_2 =0 if C3011_B==.  & Z1004=="FIN_2007"
*list A2038_2 C3011_B if Z1004=="FIN_2007"
*tab A2038_2 if Z1004=="FIN_2007"

replace A2038_3 =0 if C3011_C>5 & Z1004=="FIN_2007"
replace A2038_3 =0 if C3011_C==5 & Z1004=="FIN_2007"
replace A2038_3 =1 if C3011_C<5  & Z1004=="FIN_2007"
replace A2038_3 =0 if C3011_C==.  & Z1004=="FIN_2007"
*tab A2038_3 if Z1004=="FIN_2007"
*list C3011_C A2038_3 if Z1004=="FIN_2007"

replace A2038_4 =1 if C3011_D<5 & Z1004=="FIN_2007"
replace A2038_4 =0 if C3011_D==5 & Z1004=="FIN_2007"
replace A2038_4 =0 if C3011_D>5  & Z1004=="FIN_2007"
replace A2038_4 =0 if C3011_D==.  & Z1004=="FIN_2007"
*list C3011_D A2038_4 if Z1004=="FIN_2007"
*tab A2038_4 if Z1004=="FIN_2007"

replace A2038_5 =1 if C3011_E<5 & Z1004=="FIN_2007"
replace A2038_5 =0 if C3011_E==5 & Z1004=="FIN_2007"
replace A2038_5 =0 if C3011_E>5  & Z1004=="FIN_2007"
replace A2038_5 =0 if C3011_E==.  & Z1004=="FIN_2007"
*list C3011_E A2038_4 if Z1004=="FIN_2007"
*tab A2038_5 if Z1004=="FIN_2007"


replace A2038_6 =1 if C3011_F>5 & Z1004=="FIN_2007"
replace A2038_6 =0 if C3011_F==5 & Z1004=="FIN_2007"
replace A2038_6 =0 if C3011_F<5  & Z1004=="FIN_2007"
replace A2038_6 =0 if C3011_F==.  & Z1004=="FIN_2007"
*list C3011_H A2038_5 if Z1004=="FIN_2007"
*tab A2038_6 if Z1004=="FIN_2007"

replace A2038_7 =0 if C3011_G<5 & Z1004=="FIN_2007"
replace A2038_7 =0 if C3011_G==5 & Z1004=="FIN_2007"
replace A2038_7 =1 if C3011_G>5  & Z1004=="FIN_2007"
replace A2038_7 =0 if C3011_G==.  & Z1004=="FIN_2007"
*list C3011_G A2038_7 if Z1004=="FIN_2007"
*tab A2038_7 if Z1004=="FIN_2007"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7)/7 if Z1004=="FIN_2007"
*tab A2038 if Z1004=="FIN_2007"

**version iii

**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="FIN_2007"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="FIN_2007"
*tab  A2039_1 if Z1004=="FIN_2007"
***missings
sum C3011_A if Z1004=="FIN_2007"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="FIN_2007"
replace A2039_1_b= C5017_A-(6.57+1.55) if C3011_A==. & Z1004=="FIN_2007"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="FIN_2007"
*tab  A2039_1_b if Z1004=="FIN_2007"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="FIN_2007"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="FIN_2007"
*tab  A2039_2 if Z1004=="FIN_2007"
***missings
sum C3011_B if Z1004=="FIN_2007"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="FIN_2007"
replace A2039_2_b= C5017_B-(7.98+1.94) if C3011_B==. & Z1004=="FIN_2007"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="FIN_2007"
*tab  A2039_2_b if Z1004=="FIN_2007"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="FIN_2007"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="FIN_2007"
*tab  A2039_3 if Z1004=="FIN_2007"
***missings
sum C3011_C if Z1004=="FIN_2007"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="FIN_2007"
replace A2039_3_b= C5017_C-(4.15+1.91) if C3011_C==. & Z1004=="FIN_2007"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="FIN_2007"
*tab  A2039_3_b if Z1004=="FIN_2007"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="FIN_2007"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="FIN_2007"
*tab  A2039_4 if Z1004=="FIN_2007"
***missings
sum C3011_E if Z1004=="FIN_2007"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="FIN_2007"
replace A2039_4_b= C5017_E-(4.77+1.67) if C3011_E==. & Z1004=="FIN_2007"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="FIN_2007"
*tab  A2039_4_b if Z1004=="FIN_2007"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="FIN_2007"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="FIN_2007"
*tab  A2039_5 if Z1004=="FIN_2007"
***missings
sum C3011_D if Z1004=="FIN_2007"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="FIN_2007"
replace A2039_5_b= C5017_D-(1.87+1.74) if C3011_D==. & Z1004=="FIN_2007"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="FIN_2007"
*tab  A2039_5_b if Z1004=="FIN_2007"

*Party F
replace A2039_6 = C5017_F-C3011_F if Z1004=="FIN_2007"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="FIN_2007"
*tab  A2039_6 if Z1004=="FIN_2007"
***missings
sum C3011_F if Z1004=="FIN_2007"
replace A2039_6_b = C5017_F-C3011_F if Z1004=="FIN_2007"
replace A2039_6_b= C5017_F-(6.64+2.03) if C3011_F==. & Z1004=="FIN_2007"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="FIN_2007"
*tab  A2039_6_b if Z1004=="FIN_2007"

*Party G
replace A2039_7 = C5017_G-C3011_G if Z1004=="FIN_2007"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="FIN_2007"
*tab  A2039_7 if Z1004=="FIN_2007"
***missings
sum C3011_G if Z1004=="FIN_2007"
replace A2039_7_b = C5017_G-C3011_G if Z1004=="FIN_2007"
replace A2039_7_b= C5017_G-(6.0+1.82) if C3011_G==. & Z1004=="FIN_2007"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="FIN_2007"
*tab  A2039_7_b if Z1004=="FIN_2007"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7)/7 if Z1004=="FIN_2007"
sum A2039 if Z1004=="FIN_2007"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b)/7 if Z1004=="FIN_2007"
sum  A2039_B if Z1004=="FIN_2007"


****************************************************************************************
*FIN_2011
*tab C5017_A if Z1004=="FIN_2011" 
*tab C5017_B if Z1004=="FIN_2011" 
*tab C5017_C if Z1004=="FIN_2011" 
*tab C5017_D if Z1004=="FIN_2011" 
*tab C5017_E if Z1004=="FIN_2011"  
*tab C5017_F if Z1004=="FIN_2011" 
*tab C5017_G if Z1004=="FIN_2011"
*tab C5017_H if Z1004=="FIN_2011"

*tab C3011_A if Z1004=="FIN_2011", mis
*tab C3011_B if Z1004=="FIN_2011", mis
*tab C3011_C if Z1004=="FIN_2011", mis
*tab C3011_D if Z1004=="FIN_2011", mis
*tab C3011_E if Z1004=="FIN_2011", mis
*tab C3011_G if Z1004=="FIN_2011", mis
*tab C3011_H if Z1004=="FIN_2011", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2011"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2011"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2011"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2011"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2011"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2011"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2011"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2011"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="FIN_2011"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*8 parties 
** EFBCHDAG
replace A2037_1 =1 if C3011_E< C3011_F & Z1004=="FIN_2011"
replace A2037_1 =0 if C3011_E> C3011_F & Z1004=="FIN_2011"
replace A2037_1 =0 if C3011_E == C3011_F & Z1004=="FIN_2011"
replace A2037_1 =0 if C3011_E ==. & Z1004=="FIN_2011"
replace A2037_1 =0 if C3011_F ==. & Z1004=="FIN_2011"
*list A2037_1 C3011_E C3011_F if Z1004=="FIN_2011"
*tab A2037_1 if Z1004=="FIN_2011", miss

replace A2037_2 =0 if C3011_F< C3011_B & Z1004=="FIN_2011"
replace A2037_2 =0 if C3011_F> C3011_B & Z1004=="FIN_2011"
replace A2037_2 =1 if C3011_F == C3011_B & Z1004=="FIN_2011"
replace A2037_2 =0 if C3011_F ==. & Z1004=="FIN_2011"
replace A2037_2 =0 if C3011_B ==. & Z1004=="FIN_2011"
*list A2037_2 C3011_F C3011_B if Z1004=="FIN_2011"
*tab A2037_2 if Z1004=="FIN_2011", miss

replace A2037_3 =1 if C3011_B< C3011_C & Z1004=="FIN_2011"
replace A2037_3 =0 if C3011_B> C3011_C & Z1004=="FIN_2011"
replace A2037_3 =0 if C3011_B == C3011_C & Z1004=="FIN_2011"
replace A2037_3 =0 if C3011_B ==. & Z1004=="FIN_2011"
replace A2037_3 =0 if C3011_C ==. & Z1004=="FIN_2011"
*list A2037_3 C3011_B C3011_C if Z1004=="FIN_2011"
*tab A2037_3 if Z1004=="FIN_2011", miss

replace A2037_4 =1 if C3011_C< C3011_H & Z1004=="FIN_2011"
replace A2037_4 =0 if C3011_C> C3011_H & Z1004=="FIN_2011"
replace A2037_4 =0 if C3011_C == C3011_H & Z1004=="FIN_2011"
replace A2037_4 =0 if C3011_C ==. & Z1004=="FIN_2011"
replace A2037_4 =0 if C3011_H ==. & Z1004=="FIN_2011"
*list A2037_4 C3011_C C3011_H if Z1004=="FIN_2011"
*tab A2037_4 if Z1004=="FIN_2011"

replace A2037_5 =0 if C3011_H< C3011_D & Z1004=="FIN_2011"
replace A2037_5 =0 if C3011_H> C3011_D & Z1004=="FIN_2011"
replace A2037_5 =1 if C3011_H == C3011_D & Z1004=="FIN_2011"
replace A2037_5 =0 if C3011_H ==. & Z1004=="FIN_2011"
replace A2037_5 =0 if C3011_D ==. & Z1004=="FIN_2011"
*list A2037_5 C3011_D C3011_H if Z1004=="FIN_2011"
*tab A2037_5 if Z1004=="FIN_2011", miss

replace A2037_6 =1 if C3011_D< C3011_A & Z1004=="FIN_2011"
replace A2037_6 =0 if C3011_D> C3011_A & Z1004=="FIN_2011"
replace A2037_6 =0 if C3011_D == C3011_A & Z1004=="FIN_2011"
replace A2037_6 =0 if C3011_D ==. & Z1004=="FIN_2011"
replace A2037_6 =0 if C3011_A ==. & Z1004=="FIN_2011"
*list A2037_6 C3011_D C3011_A if Z1004=="FIN_2011"
*tab A2037_6 if Z1004=="FIN_2011", miss

replace A2037_7 =0 if C3011_A< C3011_G & Z1004=="FIN_2011"
replace A2037_7 =0 if C3011_A> C3011_G & Z1004=="FIN_2011"
replace A2037_7 =1 if C3011_A == C3011_G & Z1004=="FIN_2011"
replace A2037_7 =0 if C3011_A ==. & Z1004=="FIN_2011"
replace A2037_7 =0 if C3011_G ==. & Z1004=="FIN_2011"
*list A2037_7 C3011_F C3011_G if Z1004=="FIN_2011"
*tab A2037_7 if Z1004=="FIN_2011", miss

replace A2037_8 =0 if C3011_G< C3011_E & Z1004=="FIN_2011"
replace A2037_8 =1 if C3011_G> C3011_E & Z1004=="FIN_2011"
replace A2037_8 =0 if C3011_G == C3011_E & Z1004=="FIN_2011"
replace A2037_8 =0 if C3011_G ==. & Z1004=="FIN_2011"
replace A2037_8 =0 if C3011_E ==. & Z1004=="FIN_2011"
*list A2037_8 C3011_E C3011_G if Z1004=="FIN_2011"
*tab A2037_8 if Z1004=="FIN_2011", miss

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7+A2037_8)/8 if Z1004=="FIN_2011"
*tab A2037 if Z1004=="FIN_2011"

*ii)correct placement of parties on the left-right is following the 
*4 parties
replace A2038_1 =0 if C3011_A<5 & Z1004=="FIN_2011"
replace A2038_1 =0 if C3011_A==5 & Z1004=="FIN_2011"
replace A2038_1 =1 if C3011_A>5  & Z1004=="FIN_2011"
replace A2038_1 =0 if C3011_A==.  & Z1004=="FIN_2011"
*tab A2038_1 if Z1004=="FIN_2011"

replace A2038_2 =0 if C3011_B>5 & Z1004=="FIN_2011"
replace A2038_2 =0 if C3011_B==5 & Z1004=="FIN_2011"
replace A2038_2 =1 if C3011_B<5  & Z1004=="FIN_2011"
replace A2038_2 =0 if C3011_B==.  & Z1004=="FIN_2011"
*list A2038_2 C3011_B if Z1004=="FIN_2011"
*tab A2038_2 if Z1004=="FIN_2011"

replace A2038_3 =0 if C3011_C>5 & Z1004=="FIN_2011"
replace A2038_3 =1 if C3011_C==5 & Z1004=="FIN_2011"
replace A2038_3 =0 if C3011_C<5  & Z1004=="FIN_2011"
replace A2038_3 =0 if C3011_C==.  & Z1004=="FIN_2011"
*tab A2038_3 if Z1004=="FIN_2011"
*list C3011_C A2038_3 if Z1004=="FIN_2011"

replace A2038_4 =0 if C3011_D<5 & Z1004=="FIN_2011"
replace A2038_4 =0 if C3011_D==5 & Z1004=="FIN_2011"
replace A2038_4 =1 if C3011_D>5  & Z1004=="FIN_2011"
replace A2038_4 =0 if C3011_D==.  & Z1004=="FIN_2011"
*list C3011_D A2038_4 if Z1004=="FIN_2011"
*tab A2038_4 if Z1004=="FIN_2011"

replace A2038_5 =1 if C3011_E<5 & Z1004=="FIN_2011"
replace A2038_5 =0 if C3011_E==5 & Z1004=="FIN_2011"
replace A2038_5 =0 if C3011_E>5  & Z1004=="FIN_2011"
replace A2038_5 =0 if C3011_E==.  & Z1004=="FIN_2011"
*list C3011_E A2038_4 if Z1004=="FIN_2011"
*tab A2038_5 if Z1004=="FIN_2011"

replace A2038_6 =0 if C3011_F>5 & Z1004=="FIN_2011"
replace A2038_6 =0 if C3011_F==5 & Z1004=="FIN_2011"
replace A2038_6 =1 if C3011_F<5  & Z1004=="FIN_2011"
replace A2038_6 =0 if C3011_F==.  & Z1004=="FIN_2011"
*list C3011_H A2038_5 if Z1004=="FIN_2011"
*tab A2038_6 if Z1004=="FIN_2011"

replace A2038_7 =0 if C3011_G<5 & Z1004=="FIN_2011"
replace A2038_7 =0 if C3011_G==5 & Z1004=="FIN_2011"
replace A2038_7 =1 if C3011_G>5  & Z1004=="FIN_2011"
replace A2038_7 =0 if C3011_G==.  & Z1004=="FIN_2011"
*list C3011_G A2038_7 if Z1004=="FIN_2011"
*tab A2038_7 if Z1004=="FIN_2011"

replace A2038_8 =0 if C3011_H<5 & Z1004=="FIN_2011"
replace A2038_8 =0 if C3011_H==5 & Z1004=="FIN_2011"
replace A2038_8 =1 if C3011_H>5  & Z1004=="FIN_2011"
replace A2038_8 =0 if C3011_H==.  & Z1004=="FIN_2011"
*list C3011_H A2038_8 if Z1004=="FIN_2011"
*tab A2038_8 if Z1004=="FIN_2011"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7+A2038_8)/8 if Z1004=="FIN_2011"
*tab A2038 if Z1004=="FIN_2011"

**version iii

**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="FIN_2011"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="FIN_2011"
*tab  A2039_1 if Z1004=="FIN_2011"
***missings
sum C3011_A if Z1004=="FIN_2011"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="FIN_2011"
replace A2039_1_b= C5017_A-(8.14+1.84) if C3011_A==. & Z1004=="FIN_2011"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="FIN_2011"
*tab  A2039_1_b if Z1004=="FIN_2011"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="FIN_2011"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="FIN_2011"
*tab  A2039_2 if Z1004=="FIN_2011"
***missings
sum C3011_B if Z1004=="FIN_2011"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="FIN_2011"
replace A2039_2_b= C5017_B-(4.29+1.79) if C3011_B==. & Z1004=="FIN_2011"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="FIN_2011"
*tab  A2039_2_b if Z1004=="FIN_2011"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="FIN_2011"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="FIN_2011"
*tab  A2039_3 if Z1004=="FIN_2011"
***missings
sum C3011_C if Z1004=="FIN_2011"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="FIN_2011"
replace A2039_3_b= C5017_C-(5.51+2.25) if C3011_C==. & Z1004=="FIN_2011"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="FIN_2011"
*tab  A2039_3_b if Z1004=="FIN_2011"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="FIN_2011"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="FIN_2011"
*tab  A2039_4 if Z1004=="FIN_2011"
***missings
sum C3011_E if Z1004=="FIN_2011"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="FIN_2011"
replace A2039_4_b= C5017_E-(1.89+1.57) if C3011_E==. & Z1004=="FIN_2011"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="FIN_2011"
*tab  A2039_4_b if Z1004=="FIN_2011"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="FIN_2011"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="FIN_2011"
*tab  A2039_5 if Z1004=="FIN_2011"
***missings
sum C3011_D if Z1004=="FIN_2011"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="FIN_2011"
replace A2039_5_b= C5017_D-(6.33+1.61) if C3011_D==. & Z1004=="FIN_2011"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="FIN_2011"
*tab  A2039_5_b if Z1004=="FIN_2011"

*Party F
replace A2039_6 = C5017_F-C3011_F if Z1004=="FIN_2011"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="FIN_2011"
*tab  A2039_6 if Z1004=="FIN_2011"
***missings
sum C3011_F if Z1004=="FIN_2011"
replace A2039_6_b = C5017_F-C3011_F if Z1004=="FIN_2011"
replace A2039_6_b= C5017_F-(4.86+1.84) if C3011_F==. & Z1004=="FIN_2011"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="FIN_2011"
*tab  A2039_6_b if Z1004=="FIN_2011"

*Party G
replace A2039_7 = C5017_G-C3011_G if Z1004=="FIN_2011"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="FIN_2011"
*tab  A2039_7 if Z1004=="FIN_2011"
***missings
sum C3011_G if Z1004=="FIN_2011"
replace A2039_7_b = C5017_G-C3011_G if Z1004=="FIN_2011"
replace A2039_7_b= C5017_G-(6.85+1.97) if C3011_G==. & Z1004=="FIN_2011"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="FIN_2011"
*tab  A2039_7_b if Z1004=="FIN_2011"

*Party H
replace A2039_8 = C5017_H-C3011_H if Z1004=="FIN_2011"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="FIN_2011"
*tab  A2039_8 if Z1004=="FIN_2011"
***missings
sum C3011_H if Z1004=="FIN_2011"
replace A2039_8_b = C5017_H-C3011_H if Z1004=="FIN_2011"
replace A2039_8_b= C5017_H-(6.03+1.87) if C3011_H==. & Z1004=="FIN_2011"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="FIN_2011"
*tab  A2039_8_b if Z1004=="FIN_2011"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7+A2039_8)/8 if Z1004=="FIN_2011"
sum A2039 if Z1004=="FIN_2011"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b+A2039_8_b)/8 if Z1004=="FIN_2011"
sum  A2039_B if Z1004=="FIN_2011"


****************************************************************************************
*DEU_1998
sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="DEU_1998"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="DEU_1998"
**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*6 parties  to most left to most right?
*FDABCE
replace A2037_1 =0 if A3032_F< A3032_D & Z1004=="DEU_1998"
replace A2037_1 =0 if A3032_F> A3032_D & Z1004=="DEU_1998"
replace A2037_1 =1 if A3032_F == A3032_D & Z1004=="DEU_1998"
replace A2037_1 =0 if A3032_F ==. & Z1004=="DEU_1998"
replace A2037_1 =0 if A3032_D ==. & Z1004=="DEU_1998"
*list A2037_1 A3032_F A3032_D if Z1004=="DEU_1998"
*tab A2037_1 if Z1004=="DEU_1998"

replace A2037_2 =1 if A3032_D< A3032_A & Z1004=="DEU_1998"
replace A2037_2 =0 if A3032_D> A3032_A & Z1004=="DEU_1998"
replace A2037_2 =0 if A3032_D == A3032_A & Z1004=="DEU_1998"
replace A2037_2 =0 if A3032_D ==. & Z1004=="DEU_1998"
replace A2037_2 =0 if A3032_A ==. & Z1004=="DEU_1998"
*list A2037_2 A3032_D A3032_A if Z1004=="DEU_1998"
*tab A2037_2 if Z1004=="DEU_1998"

replace A2037_3 =1 if A3032_A< A3032_B & Z1004=="DEU_1998"
replace A2037_3 =0 if A3032_A> A3032_B & Z1004=="DEU_1998"
replace A2037_3 =0 if A3032_A == A3032_B & Z1004=="DEU_1998"
replace A2037_3 =0 if A3032_A ==. & Z1004=="DEU_1998"
replace A2037_3 =0 if A3032_B ==. & Z1004=="DEU_1998"
*list A2037_3 A3032_A A3032_B if Z1004=="DEU_1998"
*tab A2037_3 if Z1004=="DEU_1998"

replace A2037_4 =1 if A3032_B< A3032_C & Z1004=="DEU_1998"
replace A2037_4 =0 if A3032_B> A3032_C & Z1004=="DEU_1998"
replace A2037_4 =0 if A3032_B == A3032_C & Z1004=="DEU_1998" 
replace A2037_4 =0 if A3032_B ==. & Z1004=="DEU_1998"
replace A2037_4 =0 if A3032_C ==. & Z1004=="DEU_1998"
*list A2037_4 A3032_B A3032_C if Z1004=="DEU_1998" 
*tab A2037_4 if Z1004=="DEU_1998"

replace A2037_5 =0 if A3032_C< A3032_E & Z1004=="DEU_1998"
replace A2037_5 =0 if A3032_C> A3032_E & Z1004=="DEU_1998"
replace A2037_5 =1 if A3032_C == A3032_E & Z1004=="DEU_1998"
replace A2037_5 =0 if A3032_C ==. & Z1004=="DEU_1998"
replace A2037_5 =0 if A3032_E ==. & Z1004=="DEU_1998"
*list A2037_5 A3032_C A3032_E if Z1004=="DEU_1998"
*tab A2037_5 if Z1004=="DEU_1998", missing

replace A2037_6 =1 if A3032_F< A3032_E & Z1004=="DEU_1998"
replace A2037_6 =0 if A3032_F> A3032_E & Z1004=="DEU_1998"
replace A2037_6 =0 if A3032_F == A3032_E & Z1004=="DEU_1998"
replace A2037_6 =0 if A3032_F ==. & Z1004=="DEU_1998"
replace A2037_6 =0 if A3032_E ==. & Z1004=="DEU_1998"
*list A2037_5 A3032_A A3032_E if Z1004=="DEU_1998"
*tab A2037_6 if Z1004=="DEU_1998", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="DEU_1998"
*tab A2037 if Z1004=="DEU_1998"

**ii)correct placement of parties on the left-right is following the 

replace A2038_1 =1 if A3032_A<5 & Z1004=="DEU_1998"
replace A2038_1 =0 if A3032_A==5 & Z1004=="DEU_1998"
replace A2038_1 =0 if A3032_A>5  & Z1004=="DEU_1998"
replace A2038_1 =0 if A3032_A==.  & Z1004=="DEU_1998"
*tab A2038_1 if Z1004=="DEU_1998"

replace A2038_2 =1 if A3032_B>5 & Z1004=="DEU_1998"
replace A2038_2 =0 if A3032_B==5 & Z1004=="DEU_1998"
replace A2038_2 =0 if A3032_B<5  & Z1004=="DEU_1998"
replace A2038_2 =0 if A3032_B==.  & Z1004=="DEU_1998"
*tab A2038_2 if Z1004=="DEU_1998"

replace A2038_3 =1 if A3032_C>5 & Z1004=="DEU_1998"
replace A2038_3 =0 if A3032_C==5 & Z1004=="DEU_1998"
replace A2038_3 =0 if A3032_C<5  & Z1004=="DEU_1998"
replace A2038_3 =0 if A3032_C==.  & Z1004=="DEU_1998"
*tab A2038_3 if Z1004=="DEU_1998"
*list A3032_C A2038_3 if Z1004=="DEU_1998"

replace A2038_4 =1 if A3032_D<5 & Z1004=="DEU_1998"
replace A2038_4 =0 if A3032_D==5 & Z1004=="DEU_1998"
replace A2038_4 =0 if A3032_D>5  & Z1004=="DEU_1998"
replace A2038_4 =0 if A3032_D==.  & Z1004=="DEU_1998"
*list A3032_D A2038_4 if Z1004=="DEU_1998"
*tab A2038_4 if Z1004=="DEU_1998"

replace A2038_5 =0 if A3032_E<5 & Z1004=="DEU_1998"
replace A2038_5 =0 if A3032_E==5 & Z1004=="DEU_1998"
replace A2038_5 =1 if A3032_E>5  & Z1004=="DEU_1998"
replace A2038_5 =0 if A3032_E==.  & Z1004=="DEU_1998"
*list A3032_E A2038_5 if Z1004=="DEU_1998"
*tab A2038_5 if Z1004=="DEU_1998"

replace A2038_6 =1 if A3032_F<5 & Z1004=="DEU_1998"
replace A2038_6 =0 if A3032_F==5 & Z1004=="DEU_1998"
replace A2038_6 =0 if A3032_F>5  & Z1004=="DEU_1998"
replace A2038_6 =0 if A3032_F==.  & Z1004=="DEU_1998"
*list A3032_F A2038_6 if Z1004=="DEU_1998"
*tab A2038_6 if Z1004=="DEU_1998"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="DEU_1998"
*tab A2038 if Z1004=="DEU_1998"

**version iii

sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="DEU_1998"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="DEU_1998"

**Party A
replace A2039_1 = A5004_A-A3032_A if Z1004=="DEU_1998"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="DEU_1998"
*tab  A2039_1 if Z1004=="DEU_1998"
***missings
sum A3032_A if Z1004=="DEU_1998"
replace A2039_1_b = A5004_A-A3032_A if Z1004=="DEU_1998"
replace A2039_1_b= A5004_A-(3.36+1.94) if A3032_A==. & Z1004=="DEU_1998"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="DEU_1998"
*tab  A2039_1_b if Z1004=="DEU_1998"

**Party B
replace A2039_2 = A5004_B-A3032_B if Z1004=="DEU_1998"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="DEU_1998"
*tab  A2039_2 if Z1004=="DEU_1998"
***missings
sum A3032_B if Z1004=="DEU_1998"
replace A2039_2_b = A5004_B-A3032_B if Z1004=="DEU_1998"
replace A2039_2_b= A5004_B-(5.71+2.21) if A3032_B==. & Z1004=="DEU_1998"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="DEU_1998"
*tab  A2039_2_b if Z1004=="DEU_1998"

**Party C
replace A2039_3 = A5004_C-A3032_C if Z1004=="DEU_1998"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="DEU_1998"
*tab  A2039_3 if Z1004=="DEU_1998"
***missings
sum A3032_C if Z1004=="DEU_1998"
replace A2039_3_b = A5004_C-A3032_C if Z1004=="DEU_1998"
replace A2039_3_b= A5004_C-(6.3+2.37) if A3032_C==. & Z1004=="DEU_1998"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="DEU_1998"
*tab  A2039_3_b if Z1004=="DEU_1998"

**Party D
replace A2039_4 = A5004_D-A3032_D if Z1004=="DEU_1998"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="DEU_1998"
*tab  A2039_4 if Z1004=="DEU_1998"
***missings
sum A3032_D if Z1004=="DEU_1998"
replace A2039_4_b = A5004_D-A3032_D if Z1004=="DEU_1998"
replace A2039_4_b= A5004_D-(2.91+1.96) if A3032_D==. & Z1004=="DEU_1998"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="DEU_1998"
*tab  A2039_4_b if Z1004=="DEU_1998"

**Party E
replace A2039_5 = A5004_E-A3032_E if Z1004=="DEU_1998"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="DEU_1998"
*tab  A2039_5 if Z1004=="DEU_1998"
***missings
sum A3032_E if Z1004=="DEU_1998"
replace A2039_5_b = A5004_E-A3032_E if Z1004=="DEU_1998"
replace A2039_5_b= A5004_E-(4.96+1.95) if A3032_E==. & Z1004=="DEU_1998"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="DEU_1998"
*tab  A2039_5_b if Z1004=="DEU_1998"

**Party F
replace A2039_6 = A5004_F-A3032_F if Z1004=="DEU_1998"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="DEU_1998"
*tab  A2039_6 if Z1004=="DEU_1998"
***missings
sum A3032_F if Z1004=="DEU_1998"
replace A2039_6_b = A5004_F-A3032_F if Z1004=="DEU_1998"
replace A2039_6_b= A5004_F-(2.07+2.88) if A3032_F==. & Z1004=="DEU_1998"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="DEU_1998"
*tab  A2039_6_b if Z1004=="DEU_1998"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6)/6 if Z1004=="DEU_1998"
sum  A2039 if Z1004=="DEU_1998"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b)/6 if Z1004=="DEU_1998"
sum  A2039_B if Z1004=="DEU_1998"


****************************************************************************************
*ISR_1996 
sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="ISR_1996"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="ISR_1996"
**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*5 parties  to most left to most right
*EACBD
replace A2037_1 =1 if A3032_E< A3032_A & Z1004=="ISR_1996"
replace A2037_1 =0 if A3032_E> A3032_A & Z1004=="ISR_1996"
replace A2037_1 =0 if A3032_E == A3032_A & Z1004=="ISR_1996"
replace A2037_1 =0 if A3032_E ==. & Z1004=="ISR_1996"
replace A2037_1 =0 if A3032_A ==. & Z1004=="ISR_1996"
*list A2037_1 A3032_F A3032_D if Z1004=="ISR_1996"
*tab A2037_1 if Z1004=="ISR_1996"

replace A2037_2 =1 if A3032_A< A3032_C & Z1004=="ISR_1996"
replace A2037_2 =0 if A3032_A> A3032_C & Z1004=="ISR_1996"
replace A2037_2 =0 if A3032_A == A3032_C & Z1004=="ISR_1996"
replace A2037_2 =0 if A3032_A ==. & Z1004=="ISR_1996"
replace A2037_2 =0 if A3032_C ==. & Z1004=="ISR_1996"
*list A2037_2 A3032_D A3032_A if Z1004=="ISR_1996"
*tab A2037_2 if Z1004=="ISR_1996"

replace A2037_3 =1 if A3032_C< A3032_B & Z1004=="ISR_1996"
replace A2037_3 =0 if A3032_C> A3032_B & Z1004=="ISR_1996"
replace A2037_3 =0 if A3032_C == A3032_B & Z1004=="ISR_1996"
replace A2037_3 =0 if A3032_C ==. & Z1004=="ISR_1996"
replace A2037_3 =0 if A3032_B ==. & Z1004=="ISR_1996"
*list A2037_3 A3032_C A3032_B if Z1004=="ISR_1996"
*tab A2037_3 if Z1004=="ISR_1996"

replace A2037_4 =1 if A3032_B< A3032_D & Z1004=="ISR_1996"
replace A2037_4 =0 if A3032_B> A3032_D & Z1004=="ISR_1996"
replace A2037_4 =0 if A3032_B == A3032_D & Z1004=="ISR_1996" 
replace A2037_4 =0 if A3032_B ==. & Z1004=="ISR_1996"
replace A2037_4 =0 if A3032_D ==. & Z1004=="ISR_1996"
*list A2037_4 A3032_B A3032_C if Z1004=="ISR_1996" 
*tab A2037_4 if Z1004=="ISR_1996"

replace A2037_5 =1 if A3032_E< A3032_D & Z1004=="ISR_1996"
replace A2037_5 =0 if A3032_E> A3032_D & Z1004=="ISR_1996"
replace A2037_5 =0 if A3032_E == A3032_D & Z1004=="ISR_1996"
replace A2037_5 =0 if A3032_E ==. & Z1004=="ISR_1996"
replace A2037_5 =0 if A3032_D ==. & Z1004=="ISR_1996"
*list A2037_5 A3032_D A3032_E if Z1004=="ISR_1996"
*tab A2037_5 if Z1004=="ISR_1996", missing



***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="ISR_1996"
*tab A2037 if Z1004=="ISR_1996"

**ii)correct placement of parties on the left-right is following the 

replace A2038_1 =1 if A3032_A<5 & Z1004=="ISR_1996"
replace A2038_1 =0 if A3032_A==5 & Z1004=="ISR_1996"
replace A2038_1 =0 if A3032_A>5  & Z1004=="ISR_1996"
replace A2038_1 =0 if A3032_A==.  & Z1004=="ISR_1996"
*tab A2038_1 if Z1004=="ISR_1996"

replace A2038_2 =1 if A3032_B>5 & Z1004=="ISR_1996"
replace A2038_2 =0 if A3032_B==5 & Z1004=="ISR_1996"
replace A2038_2 =0 if A3032_B<5  & Z1004=="ISR_1996"
replace A2038_2 =0 if A3032_B==.  & Z1004=="ISR_1996"
*tab A2038_2 if Z1004=="ISR_1996"

replace A2038_3 =1 if A3032_C>5 & Z1004=="ISR_1996"
replace A2038_3 =0 if A3032_C==5 & Z1004=="ISR_1996"
replace A2038_3 =0 if A3032_C<5  & Z1004=="ISR_1996"
replace A2038_3 =0 if A3032_C==.  & Z1004=="ISR_1996"
*tab A2038_3 if Z1004=="ISR_1996"
*list A3032_C A2038_3 if Z1004=="ISR_1996"

replace A2038_4 =0 if A3032_D<5 & Z1004=="ISR_1996"
replace A2038_4 =0 if A3032_D==5 & Z1004=="ISR_1996"
replace A2038_4 =1 if A3032_D>5  & Z1004=="ISR_1996"
replace A2038_4 =0 if A3032_D==.  & Z1004=="ISR_1996"
*list A3032_D A2038_4 if Z1004=="ISR_1996"
*tab A2038_4 if Z1004=="ISR_1996"

replace A2038_5 =1 if A3032_E<5 & Z1004=="ISR_1996"
replace A2038_5 =0 if A3032_E==5 & Z1004=="ISR_1996"
replace A2038_5 =0 if A3032_E>5  & Z1004=="ISR_1996"
replace A2038_5 =0 if A3032_E==.  & Z1004=="ISR_1996"
*list A3032_E A2038_5 if Z1004=="ISR_1996"
*tab A2038_5 if Z1004=="ISR_1996"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="ISR_1996"
*tab A2038 if Z1004=="ISR_1996"

**version iii

sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="ISR_1996"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="ISR_1996"

**Party A
replace A2039_1 = A5004_A-A3032_A if Z1004=="ISR_1996"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="ISR_1996"
*tab  A2039_1 if Z1004=="ISR_1996"
***missings
sum A3032_A if Z1004=="ISR_1996"
replace A2039_1_b = A5004_A-A3032_A if Z1004=="ISR_1996"
replace A2039_1_b= A5004_A-(3.12+2.06) if A3032_A==. & Z1004=="ISR_1996"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="ISR_1996"
*tab  A2039_1_b if Z1004=="ISR_1996"

**Party B
replace A2039_2 = A5004_B-A3032_B if Z1004=="ISR_1996"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="ISR_1996"
*tab  A2039_2 if Z1004=="ISR_1996"
***missings
sum A3032_B if Z1004=="ISR_1996"
replace A2039_2_b = A5004_B-A3032_B if Z1004=="ISR_1996"
replace A2039_2_b= A5004_B-(7.46+1.86) if A3032_B==. & Z1004=="ISR_1996"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="ISR_1996"
*tab  A2039_2_b if Z1004=="ISR_1996"

**Party C
replace A2039_3 = A5004_C-A3032_C if Z1004=="ISR_1996"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="ISR_1996"
*tab  A2039_3 if Z1004=="ISR_1996"
***missings
sum A3032_C if Z1004=="ISR_1996"
replace A2039_3_b = A5004_C-A3032_C if Z1004=="ISR_1996"
replace A2039_3_b= A5004_C-(6.21+2.6) if A3032_C==. & Z1004=="ISR_1996"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="ISR_1996"
*tab  A2039_3_b if Z1004=="ISR_1996"

**Party D
replace A2039_4 = A5004_D-A3032_D if Z1004=="ISR_1996"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="ISR_1996"
*tab  A2039_4 if Z1004=="ISR_1996"
***missings
sum A3032_D if Z1004=="ISR_1996"
replace A2039_4_b = A5004_D-A3032_D if Z1004=="ISR_1996"
replace A2039_4_b= A5004_D-(7.32+2.21) if A3032_D==. & Z1004=="ISR_1996"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="ISR_1996"
*tab  A2039_4_b if Z1004=="ISR_1996"

**Party E
replace A2039_5 = A5004_E-A3032_E if Z1004=="ISR_1996"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="ISR_1996"
*tab  A2039_5 if Z1004=="ISR_1996"
***missings
sum A3032_E if Z1004=="ISR_1996"
replace A2039_5_b = A5004_E-A3032_E if Z1004=="ISR_1996"
replace A2039_5_b= A5004_E-(1.51+1.99) if A3032_E==. & Z1004=="ISR_1996"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="ISR_1996"
*tab  A2039_5_b if Z1004=="ISR_1996"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5)/5 if Z1004=="ISR_1996"
sum  A2039 if Z1004=="ISR_1996"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b)/5 if Z1004=="ISR_1996"
sum  A2039_B if Z1004=="ISR_1996"

****************************************************************************************
*MEX_1997 
sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="MEX_1997"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="MEX_1997"
**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*5 parties  to most left to most right
*ECADB
replace A2037_1 =1 if A3032_E< A3032_C & Z1004=="MEX_1997"
replace A2037_1 =0 if A3032_E> A3032_C & Z1004=="MEX_1997"
replace A2037_1 =0 if A3032_E == A3032_C & Z1004=="MEX_1997"
replace A2037_1 =0 if A3032_E ==. & Z1004=="MEX_1997"
replace A2037_1 =0 if A3032_C ==. & Z1004=="MEX_1997"
*list A2037_1 A3032_E A3032_C if Z1004=="MEX_1997"
*tab A2037_1 if Z1004=="MEX_1997"

replace A2037_2 =0 if A3032_A< A3032_C & Z1004=="MEX_1997"
replace A2037_2 =1 if A3032_A> A3032_C & Z1004=="MEX_1997"
replace A2037_2 =0 if A3032_A == A3032_C & Z1004=="MEX_1997"
replace A2037_2 =0 if A3032_A ==. & Z1004=="MEX_1997"
replace A2037_2 =0 if A3032_C ==. & Z1004=="MEX_1997"
*list A2037_2 A3032_D A3032_A if Z1004=="MEX_1997"
*tab A2037_2 if Z1004=="MEX_1997"

replace A2037_3 =1 if A3032_A< A3032_D & Z1004=="MEX_1997"
replace A2037_3 =0 if A3032_A> A3032_D & Z1004=="MEX_1997"
replace A2037_3 =0 if A3032_A == A3032_D & Z1004=="MEX_1997"
replace A2037_3 =0 if A3032_A ==. & Z1004=="MEX_1997"
replace A2037_3 =0 if A3032_D ==. & Z1004=="MEX_1997"
*list A2037_3 A3032_A A3032_D if Z1004=="MEX_1997"
*tab A2037_3 if Z1004=="MEX_1997"

replace A2037_4 =0 if A3032_B< A3032_D & Z1004=="MEX_1997"
replace A2037_4 =1 if A3032_B> A3032_D & Z1004=="MEX_1997"
replace A2037_4 =0 if A3032_B == A3032_D & Z1004=="MEX_1997" 
replace A2037_4 =0 if A3032_B ==. & Z1004=="MEX_1997"
replace A2037_4 =0 if A3032_D ==. & Z1004=="MEX_1997"
*list A2037_4 A3032_B A3032_C if Z1004=="MEX_1997" 
*tab A2037_4 if Z1004=="MEX_1997"

replace A2037_5 =1 if A3032_E< A3032_B & Z1004=="MEX_1997"
replace A2037_5 =0 if A3032_E> A3032_B & Z1004=="MEX_1997"
replace A2037_5 =0 if A3032_E == A3032_B & Z1004=="MEX_1997"
replace A2037_5 =0 if A3032_E ==. & Z1004=="MEX_1997"
replace A2037_5 =0 if A3032_B ==. & Z1004=="MEX_1997"
*list A2037_5 A3032_D A3032_E if Z1004=="MEX_1997"
*tab A2037_5 if Z1004=="MEX_1997", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="MEX_1997"
*tab A2037 if Z1004=="MEX_1997"

**ii)correct placement of parties on the left-right is following the 

replace A2038_1 =0 if A3032_A<5 & Z1004=="MEX_1997"
replace A2038_1 =1 if A3032_A==5 & Z1004=="MEX_1997"
replace A2038_1 =0 if A3032_A>5  & Z1004=="MEX_1997"
replace A2038_1 =0 if A3032_A==.  & Z1004=="MEX_1997"
*tab A2038_1 if Z1004=="MEX_1997"

replace A2038_2 =1 if A3032_B>5 & Z1004=="MEX_1997"
replace A2038_2 =0 if A3032_B==5 & Z1004=="MEX_1997"
replace A2038_2 =0 if A3032_B<5  & Z1004=="MEX_1997"
replace A2038_2 =0 if A3032_B==.  & Z1004=="MEX_1997"
*tab A2038_2 if Z1004=="MEX_1997"

replace A2038_3 =0 if A3032_C>5 & Z1004=="MEX_1997"
replace A2038_3 =0 if A3032_C==5 & Z1004=="MEX_1997"
replace A2038_3 =1 if A3032_C<5  & Z1004=="MEX_1997"
replace A2038_3 =0 if A3032_C==.  & Z1004=="MEX_1997"
*tab A2038_3 if Z1004=="MEX_1997"
*list A3032_C A2038_3 if Z1004=="MEX_1997"

replace A2038_4 =0 if A3032_D<5 & Z1004=="MEX_1997"
replace A2038_4 =0 if A3032_D==5 & Z1004=="MEX_1997"
replace A2038_4 =1 if A3032_D>5  & Z1004=="MEX_1997"
replace A2038_4 =0 if A3032_D==.  & Z1004=="MEX_1997"
*list A3032_D A2038_4 if Z1004=="MEX_1997"
*tab A2038_4 if Z1004=="MEX_1997"

replace A2038_5 =1 if A3032_E<5 & Z1004=="MEX_1997"
replace A2038_5 =0 if A3032_E==5 & Z1004=="MEX_1997"
replace A2038_5 =0 if A3032_E>5  & Z1004=="MEX_1997"
replace A2038_5 =0 if A3032_E==.  & Z1004=="MEX_1997"
*list A3032_E A2038_5 if Z1004=="MEX_1997"
*tab A2038_5 if Z1004=="MEX_1997"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="MEX_1997"
*tab A2038 if Z1004=="MEX_1997"

**version iii

sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="MEX_1997"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="MEX_1997"

**Party A
replace A2039_1 = A5004_A-A3032_A if Z1004=="MEX_1997"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="MEX_1997"
*tab  A2039_1 if Z1004=="MEX_1997"
***missings
sum A3032_A if Z1004=="MEX_1997"
replace A2039_1_b = A5004_A-A3032_A if Z1004=="MEX_1997"
replace A2039_1_b= A5004_A-(5.99+3.66) if A3032_A==. & Z1004=="MEX_1997"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="MEX_1997"
*tab  A2039_1_b if Z1004=="MEX_1997"

**Party B
replace A2039_2 = A5004_B-A3032_B if Z1004=="MEX_1997"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="MEX_1997"
*tab  A2039_2 if Z1004=="MEX_1997"
***missings
sum A3032_B if Z1004=="MEX_1997"
replace A2039_2_b = A5004_B-A3032_B if Z1004=="MEX_1997"
replace A2039_2_b= A5004_B-(5.22+3.44) if A3032_B==. & Z1004=="MEX_1997"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="MEX_1997"
*tab  A2039_2_b if Z1004=="MEX_1997"

**Party C
replace A2039_3 = A5004_C-A3032_C if Z1004=="MEX_1997"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="MEX_1997"
*tab  A2039_3 if Z1004=="MEX_1997"
***missings
sum A3032_C if Z1004=="MEX_1997"
replace A2039_3_b = A5004_C-A3032_C if Z1004=="MEX_1997"
replace A2039_3_b= A5004_C-(4.73+3.42) if A3032_C==. & Z1004=="MEX_1997"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="MEX_1997"
*tab  A2039_3_b if Z1004=="MEX_1997"

**Party D
replace A2039_4 = A5004_D-A3032_D if Z1004=="MEX_1997"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="MEX_1997"
*tab  A2039_4 if Z1004=="MEX_1997"
***missings
sum A3032_D if Z1004=="MEX_1997"
replace A2039_4_b = A5004_D-A3032_D if Z1004=="MEX_1997"
replace A2039_4_b= A5004_D-(3.73+3.12) if A3032_D==. & Z1004=="MEX_1997"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="MEX_1997"
*tab  A2039_4_b if Z1004=="MEX_1997"

**Party E
replace A2039_5 = A5004_E-A3032_E if Z1004=="MEX_1997"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="MEX_1997"
*tab  A2039_5 if Z1004=="MEX_1997"
***missings
sum A3032_E if Z1004=="MEX_1997"
replace A2039_5_b = A5004_E-A3032_E if Z1004=="MEX_1997"
replace A2039_5_b= A5004_E-(3.15+2.95) if A3032_E==. & Z1004=="MEX_1997"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="MEX_1997"
*tab  A2039_5_b if Z1004=="MEX_1997"



**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5)/5 if Z1004=="MEX_1997"
sum  A2039 if Z1004=="MEX_1997"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b)/5 if Z1004=="MEX_1997"
sum  A2039_B if Z1004=="MEX_1997"
****************************************************************************************

*NLD_1998
sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="NLD_1998"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="NLD_1998"
**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*5 parties  to most left to most right
*EADCB
replace A2037_1 =1 if A3032_E< A3032_A & Z1004=="NLD_1998"
replace A2037_1 =0 if A3032_E> A3032_A & Z1004=="NLD_1998"
replace A2037_1 =0 if A3032_E == A3032_A & Z1004=="NLD_1998"
replace A2037_1 =0 if A3032_E ==. & Z1004=="NLD_1998"
replace A2037_1 =0 if A3032_A ==. & Z1004=="NLD_1998"
*list A2037_1 A3032_E A3032_A if Z1004=="NLD_1998"
*tab A2037_1 if Z1004=="NLD_1998"

replace A2037_2 =1 if A3032_A< A3032_D & Z1004=="NLD_1998"
replace A2037_2 =0 if A3032_A> A3032_D & Z1004=="NLD_1998"
replace A2037_2 =0 if A3032_A == A3032_D & Z1004=="NLD_1998"
replace A2037_2 =0 if A3032_A ==. & Z1004=="NLD_1998"
replace A2037_2 =0 if A3032_D ==. & Z1004=="NLD_1998"
*list A2037_2 A3032_D A3032_A if Z1004=="NLD_1998"
*tab A2037_2 if Z1004=="NLD_1998"

replace A2037_3 =0 if A3032_C< A3032_D & Z1004=="NLD_1998"
replace A2037_3 =1 if A3032_C> A3032_D & Z1004=="NLD_1998"
replace A2037_3 =0 if A3032_C == A3032_D & Z1004=="NLD_1998"
replace A2037_3 =0 if A3032_C ==. & Z1004=="NLD_1998"
replace A2037_3 =0 if A3032_D ==. & Z1004=="NLD_1998"
*list A2037_3 A3032_C A3032_D if Z1004=="NLD_1998"
*tab A2037_3 if Z1004=="NLD_1998"

replace A2037_4 =1 if A3032_C< A3032_B & Z1004=="NLD_1998"
replace A2037_4 =0 if A3032_C> A3032_B & Z1004=="NLD_1998"
replace A2037_4 =0 if A3032_C == A3032_B & Z1004=="NLD_1998" 
replace A2037_4 =0 if A3032_C ==. & Z1004=="NLD_1998"
replace A2037_4 =0 if A3032_B ==. & Z1004=="NLD_1998"
*list A2037_4 A3032_B A3032_C if Z1004=="NLD_1998" 
*tab A2037_4 if Z1004=="NLD_1998"

replace A2037_5 =1 if A3032_E< A3032_B & Z1004=="NLD_1998"
replace A2037_5 =0 if A3032_E> A3032_B & Z1004=="NLD_1998"
replace A2037_5 =0 if A3032_E == A3032_B & Z1004=="NLD_1998"
replace A2037_5 =0 if A3032_E ==. & Z1004=="NLD_1998"
replace A2037_5 =0 if A3032_B ==. & Z1004=="NLD_1998"
*list A2037_5 A3032_D A3032_E if Z1004=="NLD_1998"
*tab A2037_5 if Z1004=="NLD_1998", missing


***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="NLD_1998"
*tab A2037 if Z1004=="NLD_1998"

**ii)correct placement of parties on the left-right is following the 

replace A2038_1 =1 if A3032_A<5 & Z1004=="NLD_1998"
replace A2038_1 =0 if A3032_A==5 & Z1004=="NLD_1998"
replace A2038_1 =0 if A3032_A>5  & Z1004=="NLD_1998"
replace A2038_1 =0 if A3032_A==.  & Z1004=="NLD_1998"
*tab A2038_1 if Z1004=="NLD_1998"

replace A2038_2 =1 if A3032_B>5 & Z1004=="NLD_1998"
replace A2038_2 =0 if A3032_B==5 & Z1004=="NLD_1998"
replace A2038_2 =0 if A3032_B<5  & Z1004=="NLD_1998"
replace A2038_2 =0 if A3032_B==.  & Z1004=="NLD_1998"
*tab A2038_2 if Z1004=="NLD_1998"

replace A2038_3 =1 if A3032_C>5 & Z1004=="NLD_1998"
replace A2038_3 =0 if A3032_C==5 & Z1004=="NLD_1998"
replace A2038_3 =0 if A3032_C<5  & Z1004=="NLD_1998"
replace A2038_3 =0 if A3032_C==.  & Z1004=="NLD_1998"
*tab A2038_3 if Z1004=="NLD_1998"
*list A3032_C A2038_3 if Z1004=="NLD_1998"

replace A2038_4 =0 if A3032_D<5 & Z1004=="NLD_1998"
replace A2038_4 =1 if A3032_D==5 & Z1004=="NLD_1998"
replace A2038_4 =0 if A3032_D>5  & Z1004=="NLD_1998"
replace A2038_4 =0 if A3032_D==.  & Z1004=="NLD_1998"
*list A3032_D A2038_4 if Z1004=="NLD_1998"
*tab A2038_4 if Z1004=="NLD_1998"

replace A2038_5 =1 if A3032_E<5 & Z1004=="NLD_1998"
replace A2038_5 =0 if A3032_E==5 & Z1004=="NLD_1998"
replace A2038_5 =0 if A3032_E>5  & Z1004=="NLD_1998"
replace A2038_5 =0 if A3032_E==.  & Z1004=="NLD_1998"
*list A3032_E A2038_5 if Z1004=="NLD_1998"
*tab A2038_5 if Z1004=="NLD_1998"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="NLD_1998"
*tab A2038 if Z1004=="NLD_1998"

**version iii
sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="NLD_1998"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="NLD_1998"

**Party A
replace A2039_1 = A5004_A-A3032_A if Z1004=="NLD_1998"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="NLD_1998"
*tab  A2039_1 if Z1004=="NLD_1998"
***missings
sum A3032_A if Z1004=="NLD_1998"
replace A2039_1_b = A5004_A-A3032_A if Z1004=="NLD_1998"
replace A2039_1_b= A5004_A-(4.25+1.78) if A3032_A==. & Z1004=="NLD_1998"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="NLD_1998"
*tab  A2039_1_b if Z1004=="NLD_1998"

**Party B
replace A2039_2 = A5004_B-A3032_B if Z1004=="NLD_1998"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="NLD_1998"
*tab  A2039_2 if Z1004=="NLD_1998"
***missings
sum A3032_B if Z1004=="NLD_1998"
replace A2039_2_b = A5004_B-A3032_B if Z1004=="NLD_1998"
replace A2039_2_b= A5004_B-(7.18+1.75) if A3032_B==. & Z1004=="NLD_1998"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="NLD_1998"
*tab  A2039_2_b if Z1004=="NLD_1998"

**Party C
replace A2039_3 = A5004_C-A3032_C if Z1004=="NLD_1998"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="NLD_1998"
*tab  A2039_3 if Z1004=="NLD_1998"
***missings
sum A3032_C if Z1004=="NLD_1998"
replace A2039_3_b = A5004_C-A3032_C if Z1004=="NLD_1998"
replace A2039_3_b= A5004_C-(6.23+1.57) if A3032_C==. & Z1004=="NLD_1998"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="NLD_1998"
*tab  A2039_3_b if Z1004=="NLD_1998"

**Party D
replace A2039_4 = A5004_D-A3032_D if Z1004=="NLD_1998"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="NLD_1998"
*tab  A2039_4 if Z1004=="NLD_1998"
***missings
sum A3032_D if Z1004=="NLD_1998"
replace A2039_4_b = A5004_D-A3032_D if Z1004=="NLD_1998"
replace A2039_4_b= A5004_D-(5.07+1.49) if A3032_D==. & Z1004=="NLD_1998"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="NLD_1998"
*tab  A2039_4_b if Z1004=="NLD_1998"

**Party E
replace A2039_5 = A5004_E-A3032_E if Z1004=="NLD_1998"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="NLD_1998"
*tab  A2039_5 if Z1004=="NLD_1998"
***missings
sum A3032_E if Z1004=="NLD_1998"
replace A2039_5_b = A5004_E-A3032_E if Z1004=="NLD_1998"
replace A2039_5_b= A5004_E-(2.84+1.58) if A3032_E==. & Z1004=="NLD_1998"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="NLD_1998"
*tab  A2039_5_b if Z1004=="NLD_1998"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5)/5 if Z1004=="NLD_1998"
sum  A2039 if Z1004=="NLD_1998"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b)/5 if Z1004=="NLD_1998"
sum  A2039_B if Z1004=="NLD_1998"

****************************************************************************************

*NZL_1996
sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F  if Z1004=="NZL_1996"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="NZL_1996"
**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*6 parties  to most left to most right
*DBCFAE
replace A2037_1 =1 if A3032_D< A3032_B & Z1004=="NZL_1996"
replace A2037_1 =0 if A3032_D> A3032_B & Z1004=="NZL_1996"
replace A2037_1 =0 if A3032_D == A3032_B & Z1004=="NZL_1996"
replace A2037_1 =0 if A3032_D ==. & Z1004=="NZL_1996"
replace A2037_1 =0 if A3032_B ==. & Z1004=="NZL_1996"
*list A2037_1 A3032_E A3032_A if Z1004=="NZL_1996"
*tab A2037_1 if Z1004=="NZL_1996"

replace A2037_2 =1 if A3032_B< A3032_C & Z1004=="NZL_1996"
replace A2037_2 =0 if A3032_B> A3032_C & Z1004=="NZL_1996"
replace A2037_2 =0 if A3032_B == A3032_C & Z1004=="NZL_1996"
replace A2037_2 =0 if A3032_B ==. & Z1004=="NZL_1996"
replace A2037_2 =0 if A3032_C ==. & Z1004=="NZL_1996"
*list A2037_2 A3032_D A3032_A if Z1004=="NZL_1996"
*tab A2037_2 if Z1004=="NZL_1996"

replace A2037_3 =1 if A3032_C< A3032_F & Z1004=="NZL_1996"
replace A2037_3 =0 if A3032_C> A3032_F & Z1004=="NZL_1996"
replace A2037_3 =0 if A3032_C == A3032_F & Z1004=="NZL_1996"
replace A2037_3 =0 if A3032_C ==. & Z1004=="NZL_1996"
replace A2037_3 =0 if A3032_F ==. & Z1004=="NZL_1996"
*list A2037_3 A3032_C A3032_D if Z1004=="NZL_1996"
*tab A2037_3 if Z1004=="NZL_1996"

replace A2037_4 =0 if A3032_F< A3032_A & Z1004=="NZL_1996"
replace A2037_4 =0 if A3032_F> A3032_A & Z1004=="NZL_1996"
replace A2037_4 =1 if A3032_F == A3032_A & Z1004=="NZL_1996" 
replace A2037_4 =0 if A3032_F ==. & Z1004=="NZL_1996"
replace A2037_4 =0 if A3032_A ==. & Z1004=="NZL_1996"
*list A2037_4 A3032_E A3032_A if Z1004=="NZL_1996" 
*tab A2037_4 if Z1004=="NZL_1996"

replace A2037_5 =0 if A3032_E< A3032_A & Z1004=="NZL_1996"
replace A2037_5 =1 if A3032_E> A3032_A & Z1004=="NZL_1996"
replace A2037_5 =0 if A3032_E == A3032_A & Z1004=="NZL_1996"
replace A2037_5 =0 if A3032_E ==. & Z1004=="NZL_1996"
replace A2037_5 =0 if A3032_A ==. & Z1004=="NZL_1996"
*list A2037_5 A3032_D A3032_E if Z1004=="NZL_1996"
*tab A2037_5 if Z1004=="NZL_1996", missing

replace A2037_6 =1 if A3032_D< A3032_E & Z1004=="NZL_1996"
replace A2037_6 =0 if A3032_D> A3032_E & Z1004=="NZL_1996"
replace A2037_6 =0 if A3032_D == A3032_E & Z1004=="NZL_1996"
replace A2037_6 =0 if A3032_D ==. & Z1004=="NZL_1996"
replace A2037_6 =0 if A3032_E ==. & Z1004=="NZL_1996"
*list A2037_5 A3032_A A3032_E if Z1004=="NZL_1996"
*tab A2037_6 if Z1004=="NZL_1996", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="NZL_1996"
*tab A2037 if Z1004=="NZL_1996"

**ii)correct placement of parties on the left-right is following the 
replace A2038_1 =0 if A3032_A<5 & Z1004=="NZL_1996"
replace A2038_1 =0 if A3032_A==5 & Z1004=="NZL_1996"
replace A2038_1 =1 if A3032_A>5  & Z1004=="NZL_1996"
replace A2038_1 =0 if A3032_A==.  & Z1004=="NZL_1996"
*tab A2038_1 if Z1004=="NZL_1996"

replace A2038_2 =0 if A3032_B>5 & Z1004=="NZL_1996"
replace A2038_2 =0 if A3032_B==5 & Z1004=="NZL_1996"
replace A2038_2 =1 if A3032_B<5  & Z1004=="NZL_1996"
replace A2038_2 =0 if A3032_B==.  & Z1004=="NZL_1996"
*tab A2038_2 if Z1004=="NZL_1996"

replace A2038_3 =1 if A3032_C>5 & Z1004=="NZL_1996"
replace A2038_3 =0 if A3032_C==5 & Z1004=="NZL_1996"
replace A2038_3 =0 if A3032_C<5  & Z1004=="NZL_1996"
replace A2038_3 =0 if A3032_C==.  & Z1004=="NZL_1996"
*tab A2038_3 if Z1004=="NZL_1996"
*list A3032_C A2038_3 if Z1004=="NZL_1996"

replace A2038_4 =1 if A3032_D<5 & Z1004=="NZL_1996"
replace A2038_4 =0 if A3032_D==5 & Z1004=="NZL_1996"
replace A2038_4 =0 if A3032_D>5  & Z1004=="NZL_1996"
replace A2038_4 =0 if A3032_D==.  & Z1004=="NZL_1996"
*list A3032_D A2038_4 if Z1004=="NZL_1996"
*tab A2038_4 if Z1004=="NZL_1996"

replace A2038_5 =0 if A3032_E<5 & Z1004=="NZL_1996"
replace A2038_5 =0 if A3032_E==5 & Z1004=="NZL_1996"
replace A2038_5 =1 if A3032_E>5  & Z1004=="NZL_1996"
replace A2038_5 =0 if A3032_E==.  & Z1004=="NZL_1996"
*list A3032_E A2038_5 if Z1004=="NZL_1996"
*tab A2038_5 if Z1004=="NZL_1996"

replace A2038_6 =0 if A3032_F<5 & Z1004=="NZL_1996"
replace A2038_6 =0 if A3032_F==5 & Z1004=="NZL_1996"
replace A2038_6 =1 if A3032_F>5  & Z1004=="NZL_1996"
replace A2038_6 =0 if A3032_F==.  & Z1004=="NZL_1996"
*list A3032_F A2038_6 if Z1004=="NZL_1996"
*tab A2038_6 if Z1004=="NZL_1996"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="NZL_1996"
*tab A2038 if Z1004=="NZL_1996"

**version iii
sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="NZL_1996"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="NZL_1996"

**Party A
replace A2039_1 = A5004_A-A3032_A if Z1004=="NZL_1996"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="NZL_1996"
*tab  A2039_1 if Z1004=="NZL_1996"
***missings
sum A3032_A if Z1004=="NZL_1996"
replace A2039_1_b = A5004_A-A3032_A if Z1004=="NZL_1996"
replace A2039_1_b= A5004_A-(7.68+2.24) if A3032_A==. & Z1004=="NZL_1996"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="NZL_1996"
*tab  A2039_1_b if Z1004=="NZL_1996"

**Party B
replace A2039_2 = A5004_B-A3032_B if Z1004=="NZL_1996"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="NZL_1996"
*tab  A2039_2 if Z1004=="NZL_1996"
***missings
sum A3032_B if Z1004=="NZL_1996"
replace A2039_2_b = A5004_B-A3032_B if Z1004=="NZL_1996"
replace A2039_2_b= A5004_B-(3.83+2.09) if A3032_B==. & Z1004=="NZL_1996"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="NZL_1996"
*tab  A2039_2_b if Z1004=="NZL_1996"

**Party C
replace A2039_3 = A5004_C-A3032_C if Z1004=="NZL_1996"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="NZL_1996"
*tab  A2039_3 if Z1004=="NZL_1996"
***missings
sum A3032_C if Z1004=="NZL_1996"
replace A2039_3_b = A5004_C-A3032_C if Z1004=="NZL_1996"
replace A2039_3_b= A5004_C-(5.44+1.93) if A3032_C==. & Z1004=="NZL_1996"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="NZL_1996"
*tab  A2039_3_b if Z1004=="NZL_1996"

**Party D
replace A2039_4 = A5004_D-A3032_D if Z1004=="NZL_1996"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="NZL_1996"
*tab  A2039_4 if Z1004=="NZL_1996"
***missings
sum A3032_D if Z1004=="NZL_1996"
replace A2039_4_b = A5004_D-A3032_D if Z1004=="NZL_1996"
replace A2039_4_b= A5004_D-(2.68+2.19) if A3032_D==. & Z1004=="NZL_1996"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="NZL_1996"
*tab  A2039_4_b if Z1004=="NZL_1996"

**Party E
replace A2039_5 = A5004_E-A3032_E if Z1004=="NZL_1996"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="NZL_1996"
*tab  A2039_5 if Z1004=="NZL_1996"
***missings
sum A3032_E if Z1004=="NZL_1996"
replace A2039_5_b = A5004_E-A3032_E if Z1004=="NZL_1996"
replace A2039_5_b= A5004_E-(8.03+2.26) if A3032_E==. & Z1004=="NZL_1996"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="NZL_1996"
*tab  A2039_5_b if Z1004=="NZL_1996"

**Party F
replace A2039_6 = A5004_F-A3032_F if Z1004=="NZL_1996"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="NZL_1996"
*tab  A2039_6 if Z1004=="NZL_1996"
***missings
sum A3032_F if Z1004=="NZL_1996"
replace A2039_6_b = A5004_F-A3032_F if Z1004=="NZL_1996"
replace A2039_6_b= A5004_F-(6.67+2.76) if A3032_F==. & Z1004=="NZL_1996"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="NZL_1996"
*tab  A2039_6_b if Z1004=="NZL_1996"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6)/6 if Z1004=="NZL_1996"
sum  A2039 if Z1004=="NZL_1996"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b)/6 if Z1004=="NZL_1996"
sum  A2039_B if Z1004=="NZL_1996"
****************************************************************************************
**POL_1997

sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F  if Z1004=="POL_1997"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="POL_1997"
**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*6 parties  to most left to most right
*FDBCAE
replace A2037_1 =1 if A3032_F< A3032_D & Z1004=="POL_1997"
replace A2037_1 =0 if A3032_F> A3032_D & Z1004=="POL_1997"
replace A2037_1 =0 if A3032_F == A3032_D & Z1004=="POL_1997"
replace A2037_1 =0 if A3032_F ==. & Z1004=="POL_1997"
replace A2037_1 =0 if A3032_D ==. & Z1004=="POL_1997"
*list A2037_1 A3032_D A3032_F if Z1004=="POL_1997"
*tab A2037_1 if Z1004=="POL_1997"

replace A2037_2 =1 if A3032_D< A3032_B & Z1004=="POL_1997"
replace A2037_2 =0 if A3032_D> A3032_B & Z1004=="POL_1997"
replace A2037_2 =0 if A3032_D == A3032_B & Z1004=="POL_1997"
replace A2037_2 =0 if A3032_D ==. & Z1004=="POL_1997"
replace A2037_2 =0 if A3032_B ==. & Z1004=="POL_1997"
*list A2037_2 A3032_D A3032_B if Z1004=="POL_1997"
*tab A2037_2 if Z1004=="POL_1997"

replace A2037_3 =1 if A3032_B< A3032_C & Z1004=="POL_1997"
replace A2037_3 =0 if A3032_B> A3032_C & Z1004=="POL_1997"
replace A2037_3 =0 if A3032_B == A3032_C & Z1004=="POL_1997"
replace A2037_3 =0 if A3032_B ==. & Z1004=="POL_1997"
replace A2037_3 =0 if A3032_C ==. & Z1004=="POL_1997"
*list A2037_3 A3032_C A3032_D if Z1004=="POL_1997"
*tab A2037_3 if Z1004=="POL_1997"

replace A2037_4 =1 if A3032_C< A3032_A & Z1004=="POL_1997"
replace A2037_4 =0 if A3032_C> A3032_A & Z1004=="POL_1997"
replace A2037_4 =0 if A3032_C == A3032_A & Z1004=="POL_1997" 
replace A2037_4 =0 if A3032_C ==. & Z1004=="POL_1997"
replace A2037_4 =0 if A3032_A ==. & Z1004=="POL_1997"
*list A2037_4 A3032_E A3032_A if Z1004=="POL_1997" 
*tab A2037_4 if Z1004=="POL_1997"

replace A2037_5 =0 if A3032_E< A3032_A & Z1004=="POL_1997"
replace A2037_5 =1 if A3032_E> A3032_A & Z1004=="POL_1997"
replace A2037_5 =0 if A3032_E == A3032_A & Z1004=="POL_1997"
replace A2037_5 =0 if A3032_E ==. & Z1004=="POL_1997"
replace A2037_5 =0 if A3032_A ==. & Z1004=="POL_1997"
*list A2037_5 A3032_D A3032_E if Z1004=="POL_1997"
*tab A2037_5 if Z1004=="POL_1997", missing

replace A2037_6 =1 if A3032_F< A3032_E & Z1004=="POL_1997"
replace A2037_6 =0 if A3032_F> A3032_E & Z1004=="POL_1997"
replace A2037_6 =0 if A3032_F == A3032_E & Z1004=="POL_1997"
replace A2037_6 =0 if A3032_F ==. & Z1004=="POL_1997"
replace A2037_6 =0 if A3032_E ==. & Z1004=="POL_1997"
*list A2037_5 A3032_A A3032_E if Z1004=="POL_1997"
*tab A2037_6 if Z1004=="POL_1997", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="POL_1997"
*tab A2037 if Z1004=="POL_1997"

**ii)correct placement of parties on the left-right is following the 
replace A2038_1 =0 if A3032_A<5 & Z1004=="POL_1997"
replace A2038_1 =0 if A3032_A==5 & Z1004=="POL_1997"
replace A2038_1 =1 if A3032_A>5  & Z1004=="POL_1997"
replace A2038_1 =0 if A3032_A==.  & Z1004=="POL_1997"
*tab A2038_1 if Z1004=="POL_1997"

replace A2038_2 =0 if A3032_B>5 & Z1004=="POL_1997"
replace A2038_2 =0 if A3032_B==5 & Z1004=="POL_1997"
replace A2038_2 =1 if A3032_B<5  & Z1004=="POL_1997"
replace A2038_2 =0 if A3032_B==.  & Z1004=="POL_1997"
*tab A2038_2 if Z1004=="POL_1997"

replace A2038_3 =1 if A3032_C>5 & Z1004=="POL_1997"
replace A2038_3 =0 if A3032_C==5 & Z1004=="POL_1997"
replace A2038_3 =0 if A3032_C<5  & Z1004=="POL_1997"
replace A2038_3 =0 if A3032_C==.  & Z1004=="POL_1997"
*tab A2038_3 if Z1004=="POL_1997"
*list A3032_C A2038_3 if Z1004=="POL_1997"

replace A2038_4 =1 if A3032_D<5 & Z1004=="POL_1997"
replace A2038_4 =0 if A3032_D==5 & Z1004=="POL_1997"
replace A2038_4 =0 if A3032_D>5  & Z1004=="POL_1997"
replace A2038_4 =0 if A3032_D==.  & Z1004=="POL_1997"
*list A3032_D A2038_4 if Z1004=="POL_1997"
*tab A2038_4 if Z1004=="POL_1997"

replace A2038_5 =0 if A3032_E<5 & Z1004=="POL_1997"
replace A2038_5 =0 if A3032_E==5 & Z1004=="POL_1997"
replace A2038_5 =1 if A3032_E>5  & Z1004=="POL_1997"
replace A2038_5 =0 if A3032_E==.  & Z1004=="POL_1997"
*list A3032_E A2038_5 if Z1004=="POL_1997"
*tab A2038_5 if Z1004=="POL_1997"

replace A2038_6 =1 if A3032_F<5 & Z1004=="POL_1997"
replace A2038_6 =0 if A3032_F==5 & Z1004=="POL_1997"
replace A2038_6 =0 if A3032_F>5  & Z1004=="POL_1997"
replace A2038_6 =0 if A3032_F==.  & Z1004=="POL_1997"
*list A3032_F A2038_6 if Z1004=="POL_1997"
*tab A2038_6 if Z1004=="POL_1997"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="POL_1997"
*tab A2038 if Z1004=="POL_1997"

**version iii
sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="POL_1997"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="POL_1997"

**Party A
replace A2039_1 = A5004_A-A3032_A if Z1004=="POL_1997"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="POL_1997"
*tab  A2039_1 if Z1004=="POL_1997"
***missings
sum A3032_A if Z1004=="POL_1997"
replace A2039_1_b = A5004_A-A3032_A if Z1004=="POL_1997"
replace A2039_1_b= A5004_A-(8.15+2.37) if A3032_A==. & Z1004=="POL_1997"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="POL_1997"
*tab  A2039_1_b if Z1004=="POL_1997"

**Party B
replace A2039_2 = A5004_B-A3032_B if Z1004=="POL_1997"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="POL_1997"
*tab  A2039_2 if Z1004=="POL_1997"
***missings
sum A3032_B if Z1004=="POL_1997"
replace A2039_2_b = A5004_B-A3032_B if Z1004=="POL_1997"
replace A2039_2_b= A5004_B-(1.66+2.02) if A3032_B==. & Z1004=="POL_1997"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="POL_1997"
*tab  A2039_2_b if Z1004=="POL_1997"

**Party C
replace A2039_3 = A5004_C-A3032_C if Z1004=="POL_1997"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="POL_1997"
*tab  A2039_3 if Z1004=="POL_1997"
***missings
sum A3032_C if Z1004=="POL_1997"
replace A2039_3_b = A5004_C-A3032_C if Z1004=="POL_1997"
replace A2039_3_b= A5004_C-(5.61+2.13) if A3032_C==. & Z1004=="POL_1997"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="POL_1997"
*tab  A2039_3_b if Z1004=="POL_1997"

**Party D
replace A2039_4 = A5004_D-A3032_D if Z1004=="POL_1997"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="POL_1997"
*tab  A2039_4 if Z1004=="POL_1997"
***missings
sum A3032_D if Z1004=="POL_1997"
replace A2039_4_b = A5004_D-A3032_D if Z1004=="POL_1997"
replace A2039_4_b= A5004_D-(3.74+2.18) if A3032_D==. & Z1004=="POL_1997"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="POL_1997"
*tab  A2039_4_b if Z1004=="POL_1997"

**Party E
replace A2039_5 = A5004_E-A3032_E if Z1004=="POL_1997"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="POL_1997"
*tab  A2039_5 if Z1004=="POL_1997"
***missings
sum A3032_E if Z1004=="POL_1997"
replace A2039_5_b = A5004_E-A3032_E if Z1004=="POL_1997"
replace A2039_5_b= A5004_E-(7.44+2.58) if A3032_E==. & Z1004=="POL_1997"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="POL_1997"
*tab  A2039_5_b if Z1004=="POL_1997"

**Party F
replace A2039_6 = A5004_F-A3032_F if Z1004=="POL_1997"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="POL_1997"
*tab  A2039_6 if Z1004=="POL_1997"
***missings
sum A3032_F if Z1004=="POL_1997"
replace A2039_6_b = A5004_F-A3032_F if Z1004=="POL_1997"
replace A2039_6_b= A5004_F-(4.10+2.36) if A3032_F==. & Z1004=="POL_1997"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="POL_1997"
*tab  A2039_6_b if Z1004=="POL_1997"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6)/6 if Z1004=="POL_1997"
sum  A2039 if Z1004=="POL_1997"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b)/6 if Z1004=="POL_1997"
sum  A2039_B if Z1004=="POL_1997"


****************************************************************************************
**ROU_1996

sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F  if Z1004=="ROU_1996"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="ROU_1996"
**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*6 parties  to most left to most right
*BCFAD
replace A2037_1 =1 if A3032_B< A3032_C & Z1004=="ROU_1996"
replace A2037_1 =0 if A3032_B> A3032_C & Z1004=="ROU_1996"
replace A2037_1 =0 if A3032_B == A3032_C & Z1004=="ROU_1996"
replace A2037_1 =0 if A3032_B ==. & Z1004=="ROU_1996"
replace A2037_1 =0 if A3032_C ==. & Z1004=="ROU_1996"
*list A2037_1 A3032_B A3032_C if Z1004=="ROU_1996"
*tab A2037_1 if Z1004=="ROU_1996"

replace A2037_2 =0 if A3032_C< A3032_F & Z1004=="ROU_1996"
replace A2037_2 =0 if A3032_C> A3032_F & Z1004=="ROU_1996"
replace A2037_2 =1 if A3032_C == A3032_F & Z1004=="ROU_1996"
replace A2037_2 =0 if A3032_C ==. & Z1004=="ROU_1996"
replace A2037_2 =0 if A3032_F ==. & Z1004=="ROU_1996"
*list A2037_2 A3032_D A3032_B if Z1004=="ROU_1996"
*tab A2037_2 if Z1004=="ROU_1996"

replace A2037_3 =1 if A3032_F< A3032_A & Z1004=="ROU_1996"
replace A2037_3 =0 if A3032_F> A3032_A & Z1004=="ROU_1996"
replace A2037_3 =0 if A3032_F == A3032_A & Z1004=="ROU_1996"
replace A2037_3 =0 if A3032_F ==. & Z1004=="ROU_1996"
replace A2037_3 =0 if A3032_A ==. & Z1004=="ROU_1996"
*list A2037_3 A3032_A A3032_F if Z1004=="ROU_1996"
*tab A2037_3 if Z1004=="ROU_1996"

replace A2037_4 =0 if A3032_D< A3032_A & Z1004=="ROU_1996"
replace A2037_4 =0 if A3032_D> A3032_A & Z1004=="ROU_1996"
replace A2037_4 =1 if A3032_D == A3032_A & Z1004=="ROU_1996" 
replace A2037_4 =0 if A3032_D ==. & Z1004=="ROU_1996"
replace A2037_4 =0 if A3032_A ==. & Z1004=="ROU_1996"
*list A2037_4 A3032_E A3032_A if Z1004=="ROU_1996" 
*tab A2037_4 if Z1004=="ROU_1996"

replace A2037_5 =1 if A3032_B< A3032_D & Z1004=="ROU_1996"
replace A2037_5 =0 if A3032_B> A3032_D & Z1004=="ROU_1996"
replace A2037_5 =0 if A3032_B == A3032_D & Z1004=="ROU_1996"
replace A2037_5 =0 if A3032_B ==. & Z1004=="ROU_1996"
replace A2037_5 =0 if A3032_D ==. & Z1004=="ROU_1996"
*list A2037_5 A3032_D A3032_E if Z1004=="ROU_1996"
*tab A2037_5 if Z1004=="ROU_1996", missing



***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="ROU_1996"
*tab A2037 if Z1004=="ROU_1996"

**ii)correct placement of parties on the left-right is following the 
replace A2038_1 =0 if A3032_A<5 & Z1004=="ROU_1996"
replace A2038_1 =1 if A3032_A==5 & Z1004=="ROU_1996"
replace A2038_1 =0 if A3032_A>5  & Z1004=="ROU_1996"
replace A2038_1 =0 if A3032_A==.  & Z1004=="ROU_1996"
*tab A2038_1 if Z1004=="ROU_1996"

replace A2038_2 =0 if A3032_B>5 & Z1004=="ROU_1996"
replace A2038_2 =0 if A3032_B==5 & Z1004=="ROU_1996"
replace A2038_2 =1 if A3032_B<5  & Z1004=="ROU_1996"
replace A2038_2 =0 if A3032_B==.  & Z1004=="ROU_1996"
*tab A2038_2 if Z1004=="ROU_1996"

replace A2038_3 =0 if A3032_C>5 & Z1004=="ROU_1996"
replace A2038_3 =0 if A3032_C==5 & Z1004=="ROU_1996"
replace A2038_3 =1 if A3032_C<5  & Z1004=="ROU_1996"
replace A2038_3 =0 if A3032_C==.  & Z1004=="ROU_1996"
*tab A2038_3 if Z1004=="ROU_1996"
*list A3032_C A2038_3 if Z1004=="ROU_1996"

replace A2038_4 =0 if A3032_D<5 & Z1004=="ROU_1996"
replace A2038_4 =1 if A3032_D==5 & Z1004=="ROU_1996"
replace A2038_4 =0 if A3032_D>5  & Z1004=="ROU_1996"
replace A2038_4 =0 if A3032_D==.  & Z1004=="ROU_1996"
*list A3032_D A2038_4 if Z1004=="ROU_1996"
*tab A2038_4 if Z1004=="ROU_1996"



replace A2038_6 =1 if A3032_F<5 & Z1004=="ROU_1996"
replace A2038_6 =0 if A3032_F==5 & Z1004=="ROU_1996"
replace A2038_6 =0 if A3032_F>5  & Z1004=="ROU_1996"
replace A2038_6 =0 if A3032_F==.  & Z1004=="ROU_1996"
*list A3032_F A2038_6 if Z1004=="ROU_1996"
*tab A2038_6 if Z1004=="ROU_1996"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_6)/5 if Z1004=="ROU_1996"
*tab A2038 if Z1004=="ROU_1996"

**version iii
sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="ROU_1996"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="ROU_1996"

**Party A
replace A2039_1 = A5004_A-A3032_A if Z1004=="ROU_1996"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="ROU_1996"
*tab  A2039_1 if Z1004=="ROU_1996"
***missings
sum A3032_A if Z1004=="ROU_1996"
replace A2039_1_b = A5004_A-A3032_A if Z1004=="ROU_1996"
replace A2039_1_b= A5004_A-(6.78+2.64) if A3032_A==. & Z1004=="ROU_1996"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="ROU_1996"
*tab  A2039_1_b if Z1004=="ROU_1996"

**Party B
replace A2039_2 = A5004_B-A3032_B if Z1004=="ROU_1996"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="ROU_1996"
*tab  A2039_2 if Z1004=="ROU_1996"
***missings
sum A3032_B if Z1004=="ROU_1996"
replace A2039_2_b = A5004_B-A3032_B if Z1004=="ROU_1996"
replace A2039_2_b= A5004_B-(3.84+2.96) if A3032_B==. & Z1004=="ROU_1996"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="ROU_1996"
*tab  A2039_2_b if Z1004=="ROU_1996"

**Party C
replace A2039_3 = A5004_C-A3032_C if Z1004=="ROU_1996"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="ROU_1996"
*tab  A2039_3 if Z1004=="ROU_1996"
***missings
sum A3032_C if Z1004=="ROU_1996"
replace A2039_3_b = A5004_C-A3032_C if Z1004=="ROU_1996"
replace A2039_3_b= A5004_C-(5.32+2.36) if A3032_C==. & Z1004=="ROU_1996"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="ROU_1996"
*tab  A2039_3_b if Z1004=="ROU_1996"

**Party D
replace A2039_4 = A5004_D-A3032_D if Z1004=="ROU_1996"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="ROU_1996"
*tab  A2039_4 if Z1004=="ROU_1996"
***missings
sum A3032_D if Z1004=="ROU_1996"
replace A2039_4_b = A5004_D-A3032_D if Z1004=="ROU_1996"
replace A2039_4_b= A5004_D-(5.28+2.97) if A3032_D==. & Z1004=="ROU_1996"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="ROU_1996"
*tab  A2039_4_b if Z1004=="ROU_1996"


**Party F
replace A2039_6 = A5004_F-A3032_F if Z1004=="ROU_1996"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="ROU_1996"
*tab  A2039_6 if Z1004=="ROU_1996"
***missings
sum A3032_F if Z1004=="ROU_1996"
replace A2039_6_b = A5004_F-A3032_F if Z1004=="ROU_1996"
replace A2039_6_b= A5004_F-(4.74+2.83) if A3032_F==. & Z1004=="ROU_1996"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="ROU_1996"
*tab  A2039_6_b if Z1004=="ROU_1996"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_6)/5 if Z1004=="ROU_1996"
sum  A2039 if Z1004=="ROU_1996"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_6_b)/5 if Z1004=="ROU_1996"
sum  A2039_B if Z1004=="ROU_1996"

****************************************************************************************
**ESP_1996

sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F  if Z1004=="ESP_1996"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="ESP_1996"
**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*5 parties  to most left to most right
*CBDEA
replace A2037_1 =1 if A3032_C< A3032_B & Z1004=="ESP_1996"
replace A2037_1 =0 if A3032_C> A3032_B & Z1004=="ESP_1996"
replace A2037_1 =0 if A3032_C == A3032_B & Z1004=="ESP_1996"
replace A2037_1 =0 if A3032_C ==. & Z1004=="ESP_1996"
replace A2037_1 =0 if A3032_B ==. & Z1004=="ESP_1996"
*list A2037_1 A3032_C A3032_B if Z1004=="ESP_1996"
*tab A2037_1 if Z1004=="ESP_1996"

replace A2037_2 =0 if A3032_D< A3032_B & Z1004=="ESP_1996"
replace A2037_2 =1 if A3032_D> A3032_B & Z1004=="ESP_1996"
replace A2037_2 =0 if A3032_D == A3032_B & Z1004=="ESP_1996"
replace A2037_2 =0 if A3032_D ==. & Z1004=="ESP_1996"
replace A2037_2 =0 if A3032_B ==. & Z1004=="ESP_1996"
*list A2037_2 A3032_D A3032_B if Z1004=="ESP_1996"
*tab A2037_2 if Z1004=="ESP_1996"

replace A2037_3 =1 if A3032_D< A3032_E & Z1004=="ESP_1996"
replace A2037_3 =0 if A3032_D> A3032_E & Z1004=="ESP_1996"
replace A2037_3 =0 if A3032_D == A3032_E & Z1004=="ESP_1996"
replace A2037_3 =0 if A3032_D ==. & Z1004=="ESP_1996"
replace A2037_3 =0 if A3032_E ==. & Z1004=="ESP_1996"
*list A2037_3 A3032_E A3032_F if Z1004=="ESP_1996"
*tab A2037_3 if Z1004=="ESP_1996"

replace A2037_4 =1 if A3032_E< A3032_A & Z1004=="ESP_1996"
replace A2037_4 =0 if A3032_E> A3032_A & Z1004=="ESP_1996"
replace A2037_4 =0 if A3032_E == A3032_A & Z1004=="ESP_1996" 
replace A2037_4 =0 if A3032_E ==. & Z1004=="ESP_1996"
replace A2037_4 =0 if A3032_A ==. & Z1004=="ESP_1996"
*list A2037_4 A3032_E A3032_A if Z1004=="ESP_1996" 
*tab A2037_4 if Z1004=="ESP_1996"

replace A2037_5 =1 if A3032_C< A3032_A & Z1004=="ESP_1996"
replace A2037_5 =0 if A3032_C> A3032_A & Z1004=="ESP_1996"
replace A2037_5 =0 if A3032_C == A3032_A & Z1004=="ESP_1996"
replace A2037_5 =0 if A3032_C ==. & Z1004=="ESP_1996"
replace A2037_5 =0 if A3032_A ==. & Z1004=="ESP_1996"
*list A2037_5 A3032_D A3032_E if Z1004=="ESP_1996"
*tab A2037_5 if Z1004=="ESP_1996", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="ESP_1996"
*tab A2037 if Z1004=="ESP_1996"

**ii)correct placement of parties on the left-right is following the 
replace A2038_1 =0 if A3032_A<5 & Z1004=="ESP_1996"
replace A2038_1 =0 if A3032_A==5 & Z1004=="ESP_1996"
replace A2038_1 =1 if A3032_A>5  & Z1004=="ESP_1996"
replace A2038_1 =0 if A3032_A==.  & Z1004=="ESP_1996"
*tab A2038_1 if Z1004=="ESP_1996"

replace A2038_2 =0 if A3032_B>5 & Z1004=="ESP_1996"
replace A2038_2 =0 if A3032_B==5 & Z1004=="ESP_1996"
replace A2038_2 =1 if A3032_B<5  & Z1004=="ESP_1996"
replace A2038_2 =0 if A3032_B==.  & Z1004=="ESP_1996"
*tab A2038_2 if Z1004=="ESP_1996"

replace A2038_3 =0 if A3032_C>5 & Z1004=="ESP_1996"
replace A2038_3 =0 if A3032_C==5 & Z1004=="ESP_1996"
replace A2038_3 =1 if A3032_C<5  & Z1004=="ESP_1996"
replace A2038_3 =0 if A3032_C==.  & Z1004=="ESP_1996"
*tab A2038_3 if Z1004=="ESP_1996"
*list A3032_C A2038_3 if Z1004=="ESP_1996"

replace A2038_4 =1 if A3032_D<5 & Z1004=="ESP_1996"
replace A2038_4 =0 if A3032_D==5 & Z1004=="ESP_1996"
replace A2038_4 =0 if A3032_D>5  & Z1004=="ESP_1996"
replace A2038_4 =0 if A3032_D==.  & Z1004=="ESP_1996"
*list A3032_D A2038_4 if Z1004=="ESP_1996"
*tab A2038_4 if Z1004=="ESP_1996"

replace A2038_5 =0 if A3032_E<5 & Z1004=="ESP_1996"
replace A2038_5 =1 if A3032_E==5 & Z1004=="ESP_1996"
replace A2038_5 =0 if A3032_E>5  & Z1004=="ESP_1996"
replace A2038_5 =0 if A3032_E==.  & Z1004=="ESP_1996"
*list A3032_E A2038_5 if Z1004=="ESP_1996"
*tab A2038_5 if Z1004=="ESP_1996"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="ESP_1996"
*tab A2038 if Z1004=="ESP_1996"

**version iii
sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="ESP_1996"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="ESP_1996"

**Party A
replace A2039_1 = A5004_A-A3032_A if Z1004=="ESP_1996"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="ESP_1996"
*tab  A2039_1 if Z1004=="ESP_1996"
***missings
sum A3032_A if Z1004=="ESP_1996"
replace A2039_1_b = A5004_A-A3032_A if Z1004=="ESP_1996"
replace A2039_1_b= A5004_A-(7.84+1.77) if A3032_A==. & Z1004=="ESP_1996"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="ESP_1996"
*tab  A2039_1_b if Z1004=="ESP_1996"

**Party B
replace A2039_2 = A5004_B-A3032_B if Z1004=="ESP_1996"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="ESP_1996"
*tab  A2039_2 if Z1004=="ESP_1996"
***missings
sum A3032_B if Z1004=="ESP_1996"
replace A2039_2_b = A5004_B-A3032_B if Z1004=="ESP_1996"
replace A2039_2_b= A5004_B-(4.02+1.85) if A3032_B==. & Z1004=="ESP_1996"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="ESP_1996"
*tab  A2039_2_b if Z1004=="ESP_1996"

**Party C
replace A2039_3 = A5004_C-A3032_C if Z1004=="ESP_1996"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="ESP_1996"
*tab  A2039_3 if Z1004=="ESP_1996"
***missings
sum A3032_C if Z1004=="ESP_1996"
replace A2039_3_b = A5004_C-A3032_C if Z1004=="ESP_1996"
replace A2039_3_b= A5004_C-(2.28+1.71) if A3032_C==. & Z1004=="ESP_1996"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="ESP_1996"
*tab  A2039_3_b if Z1004=="ESP_1996"

**Party D
replace A2039_4 = A5004_D-A3032_D if Z1004=="ESP_1996"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="ESP_1996"
*tab  A2039_4 if Z1004=="ESP_1996"
***missings
sum A3032_D if Z1004=="ESP_1996"
replace A2039_4_b = A5004_D-A3032_D if Z1004=="ESP_1996"
replace A2039_4_b= A5004_D-(5.76+2.13) if A3032_D==. & Z1004=="ESP_1996"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="ESP_1996"
*tab  A2039_4_b if Z1004=="ESP_1996"

**Party E
replace A2039_5 = A5004_E-A3032_E if Z1004=="ESP_1996"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="ESP_1996"
*tab  A2039_5 if Z1004=="ESP_1996"
***missings
sum A3032_E if Z1004=="ESP_1996"
replace A2039_5_b = A5004_E-A3032_E if Z1004=="ESP_1996"
replace A2039_5_b= A5004_E-(5.47+2.27) if A3032_E==. & Z1004=="ESP_1996"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="ESP_1996"
*tab  A2039_5_b if Z1004=="ESP_1996"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5)/5 if Z1004=="ESP_1996"
sum  A2039 if Z1004=="ESP_1996"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b)/5 if Z1004=="ESP_1996"
sum  A2039_B if Z1004=="ESP_1996"
****************************************************************************************
***SWE_1998

sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F  if Z1004=="SWE_1998"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="SWE_1998"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*6 parties  to most left to most right
*CAEDFB
replace A2037_1 =1 if A3032_C< A3032_A & Z1004=="SWE_1998"
replace A2037_1 =0 if A3032_C> A3032_A & Z1004=="SWE_1998"
replace A2037_1 =0 if A3032_C == A3032_A & Z1004=="SWE_1998"
replace A2037_1 =0 if A3032_C ==. & Z1004=="SWE_1998"
replace A2037_1 =0 if A3032_A ==. & Z1004=="SWE_1998"
*list A2037_1 A3032_C A3032_A if Z1004=="SWE_1998"
*tab A2037_1 if Z1004=="SWE_1998"

replace A2037_2 =1 if A3032_A< A3032_E & Z1004=="SWE_1998"
replace A2037_2 =0 if A3032_A> A3032_E & Z1004=="SWE_1998"
replace A2037_2 =0 if A3032_A == A3032_E & Z1004=="SWE_1998"
replace A2037_2 =0 if A3032_A ==. & Z1004=="SWE_1998"
replace A2037_2 =0 if A3032_E ==. & Z1004=="SWE_1998"
*list A2037_2 A3032_D A3032_B if Z1004=="SWE_1998"
*tab A2037_2 if Z1004=="SWE_1998"

replace A2037_3 =0 if A3032_D< A3032_E & Z1004=="SWE_1998"
replace A2037_3 =1 if A3032_D> A3032_E & Z1004=="SWE_1998"
replace A2037_3 =0 if A3032_D == A3032_E & Z1004=="SWE_1998"
replace A2037_3 =0 if A3032_D ==. & Z1004=="SWE_1998"
replace A2037_3 =0 if A3032_E ==. & Z1004=="SWE_1998"
*list A2037_3 A3032_E A3032_F if Z1004=="SWE_1998"
*tab A2037_3 if Z1004=="SWE_1998"

replace A2037_4 =0 if A3032_D< A3032_F & Z1004=="SWE_1998"
replace A2037_4 =0 if A3032_D> A3032_F & Z1004=="SWE_1998"
replace A2037_4 =1 if A3032_D == A3032_F & Z1004=="SWE_1998" 
replace A2037_4 =0 if A3032_D ==. & Z1004=="SWE_1998"
replace A2037_4 =0 if A3032_F ==. & Z1004=="SWE_1998"
*list A2037_4 A3032_E A3032_A if Z1004=="SWE_1998" 
*tab A2037_4 if Z1004=="SWE_1998"

replace A2037_5 =1 if A3032_F< A3032_B & Z1004=="SWE_1998"
replace A2037_5 =0 if A3032_F> A3032_B & Z1004=="SWE_1998"
replace A2037_5 =0 if A3032_F == A3032_B & Z1004=="SWE_1998"
replace A2037_5 =0 if A3032_F ==. & Z1004=="SWE_1998"
replace A2037_5 =0 if A3032_B ==. & Z1004=="SWE_1998"
*list A2037_5 A3032_D A3032_E if Z1004=="SWE_1998"
*tab A2037_5 if Z1004=="SWE_1998", missing

replace A2037_6 =1 if A3032_C< A3032_B & Z1004=="SWE_1998"
replace A2037_6 =0 if A3032_C> A3032_B & Z1004=="SWE_1998"
replace A2037_6 =0 if A3032_C == A3032_B & Z1004=="SWE_1998"
replace A2037_6 =0 if A3032_C ==. & Z1004=="SWE_1998"
replace A2037_6 =0 if A3032_B ==. & Z1004=="SWE_1998"
*list A2037_5 A3032_A A3032_E if Z1004=="SWE_1998"
*tab A2037_6 if Z1004=="SWE_1998", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="SWE_1998"
*tab A2037 if Z1004=="SWE_1998"

**ii)correct placement of parties on the left-right is following the 
replace A2038_1 =1 if A3032_A<5 & Z1004=="SWE_1998"
replace A2038_1 =0 if A3032_A==5 & Z1004=="SWE_1998"
replace A2038_1 =0 if A3032_A>5  & Z1004=="SWE_1998"
replace A2038_1 =0 if A3032_A==.  & Z1004=="SWE_1998"
*tab A2038_1 if Z1004=="SWE_1998"

replace A2038_2 =1 if A3032_B>5 & Z1004=="SWE_1998"
replace A2038_2 =0 if A3032_B==5 & Z1004=="SWE_1998"
replace A2038_2 =0 if A3032_B<5  & Z1004=="SWE_1998"
replace A2038_2 =0 if A3032_B==.  & Z1004=="SWE_1998"
*tab A2038_2 if Z1004=="SWE_1998"

replace A2038_3 =0 if A3032_C>5 & Z1004=="SWE_1998"
replace A2038_3 =0 if A3032_C==5 & Z1004=="SWE_1998"
replace A2038_3 =1 if A3032_C<5  & Z1004=="SWE_1998"
replace A2038_3 =0 if A3032_C==.  & Z1004=="SWE_1998"
*tab A2038_3 if Z1004=="SWE_1998"
*list A3032_C A2038_3 if Z1004=="SWE_1998"

replace A2038_4 =0 if A3032_D<5 & Z1004=="SWE_1998"
replace A2038_4 =0 if A3032_D==5 & Z1004=="SWE_1998"
replace A2038_4 =1 if A3032_D>5  & Z1004=="SWE_1998"
replace A2038_4 =0 if A3032_D==.  & Z1004=="SWE_1998"
*list A3032_D A2038_4 if Z1004=="SWE_1998"
*tab A2038_4 if Z1004=="SWE_1998"

replace A2038_5 =0 if A3032_E<5 & Z1004=="SWE_1998"
replace A2038_5 =0 if A3032_E==5 & Z1004=="SWE_1998"
replace A2038_5 =1 if A3032_E>5  & Z1004=="SWE_1998"
replace A2038_5 =0 if A3032_E==.  & Z1004=="SWE_1998"
*list A3032_E A2038_5 if Z1004=="SWE_1998"
*tab A2038_5 if Z1004=="SWE_1998"

replace A2038_6 =0 if A3032_F<5 & Z1004=="SWE_1998"
replace A2038_6 =0 if A3032_F==5 & Z1004=="SWE_1998"
replace A2038_6 =1 if A3032_F>5  & Z1004=="SWE_1998"
replace A2038_6 =0 if A3032_F==.  & Z1004=="SWE_1998"
*list A3032_F A2038_6 if Z1004=="SWE_1998"
*tab A2038_6 if Z1004=="SWE_1998"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="SWE_1998"
*tab A2038 if Z1004=="SWE_1998"

**version iii
sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="SWE_1998"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="SWE_1998"

**Party A
replace A2039_1 = A5004_A-A3032_A if Z1004=="SWE_1998"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="SWE_1998"
*tab  A2039_1 if Z1004=="SWE_1998"
***missings
sum A3032_A if Z1004=="SWE_1998"
replace A2039_1_b = A5004_A-A3032_A if Z1004=="SWE_1998"
replace A2039_1_b= A5004_A-(3.48+1.89) if A3032_A==. & Z1004=="SWE_1998"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="SWE_1998"
*tab  A2039_1_b if Z1004=="SWE_1998"

**Party B
replace A2039_2 = A5004_B-A3032_B if Z1004=="SWE_1998"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="SWE_1998"
*tab  A2039_2 if Z1004=="SWE_1998"
***missings
sum A3032_B if Z1004=="SWE_1998"
replace A2039_2_b = A5004_B-A3032_B if Z1004=="SWE_1998"
replace A2039_2_b= A5004_B-(9.02+1.52) if A3032_B==. & Z1004=="SWE_1998"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="SWE_1998"
*tab  A2039_2_b if Z1004=="SWE_1998"

**Party C
replace A2039_3 = A5004_C-A3032_C if Z1004=="SWE_1998"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="SWE_1998"
*tab  A2039_3 if Z1004=="SWE_1998"
***missings
sum A3032_C if Z1004=="SWE_1998"
replace A2039_3_b = A5004_C-A3032_C if Z1004=="SWE_1998"
replace A2039_3_b= A5004_C-(1.24+1.37) if A3032_C==. & Z1004=="SWE_1998"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="SWE_1998"
*tab  A2039_3_b if Z1004=="SWE_1998"

**Party D
replace A2039_4 = A5004_D-A3032_D if Z1004=="SWE_1998"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="SWE_1998"
*tab  A2039_4 if Z1004=="SWE_1998"
***missings
sum A3032_D if Z1004=="SWE_1998"
replace A2039_4_b = A5004_D-A3032_D if Z1004=="SWE_1998"
replace A2039_4_b= A5004_D-(6.97+1.82) if A3032_D==. & Z1004=="SWE_1998"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="SWE_1998"
*tab  A2039_4_b if Z1004=="SWE_1998"

**Party E
replace A2039_5 = A5004_E-A3032_E if Z1004=="SWE_1998"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="SWE_1998"
*tab  A2039_5 if Z1004=="SWE_1998"
***missings
sum A3032_E if Z1004=="SWE_1998"
replace A2039_5_b = A5004_E-A3032_E if Z1004=="SWE_1998"
replace A2039_5_b= A5004_E-(5.43+1.28) if A3032_E==. & Z1004=="SWE_1998"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="SWE_1998"
*tab  A2039_5_b if Z1004=="SWE_1998"

**Party F
replace A2039_6 = A5004_F-A3032_F if Z1004=="SWE_1998"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="SWE_1998"
*tab  A2039_6 if Z1004=="SWE_1998"
***missings
sum A3032_F if Z1004=="SWE_1998"
replace A2039_6_b = A5004_F-A3032_F if Z1004=="SWE_1998"
replace A2039_6_b= A5004_F-(6.40+1.44) if A3032_F==. & Z1004=="SWE_1998"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="SWE_1998"
*tab  A2039_6_b if Z1004=="SWE_1998"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6)/6 if Z1004=="SWE_1998"
sum  A2039 if Z1004=="SWE_1998"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b)/6 if Z1004=="SWE_1998"
sum  A2039_B if Z1004=="SWE_1998"

****************************************************************************************
***CHE_1999

sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F  if Z1004=="CHE_1999"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="CHE_1999"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*5 parties  to most left to most right
*EBDCA
replace A2037_1 =1 if A3032_C< A3032_A & Z1004=="CHE_1999"
replace A2037_1 =0 if A3032_C> A3032_A & Z1004=="CHE_1999"
replace A2037_1 =0 if A3032_C == A3032_A & Z1004=="CHE_1999"
replace A2037_1 =0 if A3032_C ==. & Z1004=="CHE_1999"
replace A2037_1 =0 if A3032_A ==. & Z1004=="CHE_1999"
*list A2037_1 A3032_C A3032_A if Z1004=="CHE_1999"
*tab A2037_1 if Z1004=="CHE_1999"

replace A2037_2 =0 if A3032_A< A3032_E & Z1004=="CHE_1999"
replace A2037_2 =1 if A3032_A> A3032_E & Z1004=="CHE_1999"
replace A2037_2 =0 if A3032_A == A3032_E & Z1004=="CHE_1999"
replace A2037_2 =0 if A3032_A ==. & Z1004=="CHE_1999"
replace A2037_2 =0 if A3032_E ==. & Z1004=="CHE_1999"
*list A2037_2 A3032_D A3032_B if Z1004=="CHE_1999"
*tab A2037_2 if Z1004=="CHE_1999"

replace A2037_3 =1 if A3032_E< A3032_B & Z1004=="CHE_1999"
replace A2037_3 =0 if A3032_E> A3032_B & Z1004=="CHE_1999"
replace A2037_3 =0 if A3032_E == A3032_B & Z1004=="CHE_1999"
replace A2037_3 =0 if A3032_E ==. & Z1004=="CHE_1999"
replace A2037_3 =0 if A3032_B ==. & Z1004=="CHE_1999"
*list A2037_3 A3032_E A3032_F if Z1004=="CHE_1999"
*tab A2037_3 if Z1004=="CHE_1999"

replace A2037_4 =1 if A3032_B< A3032_D & Z1004=="CHE_1999"
replace A2037_4 =0 if A3032_B> A3032_D & Z1004=="CHE_1999"
replace A2037_4 =0 if A3032_B == A3032_D & Z1004=="CHE_1999" 
replace A2037_4 =0 if A3032_B ==. & Z1004=="CHE_1999"
replace A2037_4 =0 if A3032_D ==. & Z1004=="CHE_1999"
*list A2037_4 A3032_E A3032_A if Z1004=="CHE_1999" 
*tab A2037_4 if Z1004=="CHE_1999"

replace A2037_5 =1 if A3032_D< A3032_C & Z1004=="CHE_1999"
replace A2037_5 =0 if A3032_D> A3032_C & Z1004=="CHE_1999"
replace A2037_5 =0 if A3032_D == A3032_C & Z1004=="CHE_1999"
replace A2037_5 =0 if A3032_D ==. & Z1004=="CHE_1999"
replace A2037_5 =0 if A3032_C ==. & Z1004=="CHE_1999"
*list A2037_5 A3032_D A3032_E if Z1004=="CHE_1999"
*tab A2037_5 if Z1004=="CHE_1999", missing


***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="CHE_1999"
*tab A2037 if Z1004=="CHE_1999"

**ii)correct placement of parties on the left-right is following the 
replace A2038_1 =0 if A3032_A<5 & Z1004=="CHE_1999"
replace A2038_1 =0 if A3032_A==5 & Z1004=="CHE_1999"
replace A2038_1 =1 if A3032_A>5  & Z1004=="CHE_1999"
replace A2038_1 =0 if A3032_A==.  & Z1004=="CHE_1999"
*tab A2038_1 if Z1004=="CHE_1999"

replace A2038_2 =0 if A3032_B>5 & Z1004=="CHE_1999"
replace A2038_2 =0 if A3032_B==5 & Z1004=="CHE_1999"
replace A2038_2 =1 if A3032_B<5  & Z1004=="CHE_1999"
replace A2038_2 =0 if A3032_B==.  & Z1004=="CHE_1999"
*tab A2038_2 if Z1004=="CHE_1999"

replace A2038_3 =1 if A3032_C>5 & Z1004=="CHE_1999"
replace A2038_3 =0 if A3032_C==5 & Z1004=="CHE_1999"
replace A2038_3 =0 if A3032_C<5  & Z1004=="CHE_1999"
replace A2038_3 =0 if A3032_C==.  & Z1004=="CHE_1999"
*tab A2038_3 if Z1004=="CHE_1999"
*list A3032_C A2038_3 if Z1004=="CHE_1999"

replace A2038_4 =0 if A3032_D<5 & Z1004=="CHE_1999"
replace A2038_4 =0 if A3032_D==5 & Z1004=="CHE_1999"
replace A2038_4 =1 if A3032_D>5  & Z1004=="CHE_1999"
replace A2038_4 =0 if A3032_D==.  & Z1004=="CHE_1999"
*list A3032_D A2038_4 if Z1004=="CHE_1999"
*tab A2038_4 if Z1004=="CHE_1999"

replace A2038_5 =1 if A3032_E<5 & Z1004=="CHE_1999"
replace A2038_5 =0 if A3032_E==5 & Z1004=="CHE_1999"
replace A2038_5 =0 if A3032_E>5  & Z1004=="CHE_1999"
replace A2038_5 =0 if A3032_E==.  & Z1004=="CHE_1999"
*list A3032_E A2038_5 if Z1004=="CHE_1999"
*tab A2038_5 if Z1004=="CHE_1999"



*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="CHE_1999"
*tab A2038 if Z1004=="CHE_1999"

**version iii
sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="CHE_1999"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="CHE_1999"

**Party A
replace A2039_1 = A5004_A-A3032_A if Z1004=="CHE_1999"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="CHE_1999"
*tab  A2039_1 if Z1004=="CHE_1999"
***missings
sum A3032_A if Z1004=="CHE_1999"
replace A2039_1_b = A5004_A-A3032_A if Z1004=="CHE_1999"
replace A2039_1_b= A5004_A-(7.6+2.33) if A3032_A==. & Z1004=="CHE_1999"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="CHE_1999"
*tab  A2039_1_b if Z1004=="CHE_1999"

**Party B
replace A2039_2 = A5004_B-A3032_B if Z1004=="CHE_1999"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="CHE_1999"
*tab  A2039_2 if Z1004=="CHE_1999"
***missings
sum A3032_B if Z1004=="CHE_1999"
replace A2039_2_b = A5004_B-A3032_B if Z1004=="CHE_1999"
replace A2039_2_b= A5004_B-(3.29+2.17) if A3032_B==. & Z1004=="CHE_1999"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="CHE_1999"
*tab  A2039_2_b if Z1004=="CHE_1999"

**Party C
replace A2039_3 = A5004_C-A3032_C if Z1004=="CHE_1999"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="CHE_1999"
*tab  A2039_3 if Z1004=="CHE_1999"
***missings
sum A3032_C if Z1004=="CHE_1999"
replace A2039_3_b = A5004_C-A3032_C if Z1004=="CHE_1999"
replace A2039_3_b= A5004_C-(6.16+1.81) if A3032_C==. & Z1004=="CHE_1999"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="CHE_1999"
*tab  A2039_3_b if Z1004=="CHE_1999"

**Party D
replace A2039_4 = A5004_D-A3032_D if Z1004=="CHE_1999"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="CHE_1999"
*tab  A2039_4 if Z1004=="CHE_1999"
***missings
sum A3032_D if Z1004=="CHE_1999"
replace A2039_4_b = A5004_D-A3032_D if Z1004=="CHE_1999"
replace A2039_4_b= A5004_D-(5.54+1.7) if A3032_D==. & Z1004=="CHE_1999"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="CHE_1999"
*tab  A2039_4_b if Z1004=="CHE_1999"

**Party E
replace A2039_5 = A5004_E-A3032_E if Z1004=="CHE_1999"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="CHE_1999"
*tab  A2039_5 if Z1004=="CHE_1999"
***missings
sum A3032_E if Z1004=="CHE_1999"
replace A2039_5_b = A5004_E-A3032_E if Z1004=="CHE_1999"
replace A2039_5_b= A5004_E-(3.03+1.97) if A3032_E==. & Z1004=="CHE_1999"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="CHE_1999"
*tab  A2039_5_b if Z1004=="CHE_1999"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5)/5 if Z1004=="CHE_1999"
sum  A2039 if Z1004=="CHE_1999"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b)/5 if Z1004=="CHE_1999"
sum  A2039_B if Z1004=="CHE_1999"

****************************************************************************************
***MEX_2000

sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F  if Z1004=="MEX_2000"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="MEX_2000"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*5 parties  to most left to most right
*DCFBA
replace A2037_1 =1 if A3032_D< A3032_C & Z1004=="MEX_2000"
replace A2037_1 =0 if A3032_D> A3032_C & Z1004=="MEX_2000"
replace A2037_1 =0 if A3032_D == A3032_C & Z1004=="MEX_2000"
replace A2037_1 =0 if A3032_D ==. & Z1004=="MEX_2000"
replace A2037_1 =0 if A3032_C ==. & Z1004=="MEX_2000"
*list A2037_1 A3032_C A3032_A if Z1004=="MEX_2000"
*tab A2037_1 if Z1004=="MEX_2000"

replace A2037_2 =1 if A3032_C< A3032_F & Z1004=="MEX_2000"
replace A2037_2 =0 if A3032_C> A3032_F & Z1004=="MEX_2000"
replace A2037_2 =0 if A3032_C == A3032_F & Z1004=="MEX_2000"
replace A2037_2 =0 if A3032_C ==. & Z1004=="MEX_2000"
replace A2037_2 =0 if A3032_F ==. & Z1004=="MEX_2000"
*list A2037_2 A3032_D A3032_B if Z1004=="MEX_2000"
*tab A2037_2 if Z1004=="MEX_2000"

replace A2037_3 =1 if A3032_F< A3032_B & Z1004=="MEX_2000"
replace A2037_3 =0 if A3032_F> A3032_B & Z1004=="MEX_2000"
replace A2037_3 =0 if A3032_F == A3032_B & Z1004=="MEX_2000"
replace A2037_3 =0 if A3032_F ==. & Z1004=="MEX_2000"
replace A2037_3 =0 if A3032_B ==. & Z1004=="MEX_2000"
*list A2037_3 A3032_E A3032_F if Z1004=="MEX_2000"
*tab A2037_3 if Z1004=="MEX_2000"

replace A2037_4 =1 if A3032_B< A3032_A & Z1004=="MEX_2000"
replace A2037_4 =0 if A3032_B> A3032_A & Z1004=="MEX_2000"
replace A2037_4 =0 if A3032_B == A3032_A & Z1004=="MEX_2000" 
replace A2037_4 =0 if A3032_B ==. & Z1004=="MEX_2000"
replace A2037_4 =0 if A3032_A ==. & Z1004=="MEX_2000"
*list A2037_4 A3032_E A3032_A if Z1004=="MEX_2000" 
*tab A2037_4 if Z1004=="MEX_2000"

replace A2037_5 =1 if A3032_D< A3032_A & Z1004=="MEX_2000"
replace A2037_5 =0 if A3032_D> A3032_A & Z1004=="MEX_2000"
replace A2037_5 =0 if A3032_D == A3032_A & Z1004=="MEX_2000"
replace A2037_5 =0 if A3032_D ==. & Z1004=="MEX_2000"
replace A2037_5 =0 if A3032_A ==. & Z1004=="MEX_2000"
*list A2037_5 A3032_D A3032_E if Z1004=="MEX_2000"
*tab A2037_5 if Z1004=="MEX_2000", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="MEX_2000"
*tab A2037 if Z1004=="MEX_2000"

**ii)correct placement of parties on the left-right is following the 
replace A2038_1 =0 if A3032_A<5 & Z1004=="MEX_2000"
replace A2038_1 =0 if A3032_A==5 & Z1004=="MEX_2000"
replace A2038_1 =1 if A3032_A>5  & Z1004=="MEX_2000"
replace A2038_1 =0 if A3032_A==.  & Z1004=="MEX_2000"
*tab A2038_1 if Z1004=="MEX_2000"

replace A2038_2 =0 if A3032_B>5 & Z1004=="MEX_2000"
replace A2038_2 =1 if A3032_B==5 & Z1004=="MEX_2000"
replace A2038_2 =0 if A3032_B<5  & Z1004=="MEX_2000"
replace A2038_2 =0 if A3032_B==.  & Z1004=="MEX_2000"
*tab A2038_2 if Z1004=="MEX_2000"

replace A2038_3 =0 if A3032_C>5 & Z1004=="MEX_2000"
replace A2038_3 =0 if A3032_C==5 & Z1004=="MEX_2000"
replace A2038_3 =1 if A3032_C<5  & Z1004=="MEX_2000"
replace A2038_3 =0 if A3032_C==.  & Z1004=="MEX_2000"
*tab A2038_3 if Z1004=="MEX_2000"
*list A3032_C A2038_3 if Z1004=="MEX_2000"

replace A2038_4 =1 if A3032_D<5 & Z1004=="MEX_2000"
replace A2038_4 =0 if A3032_D==5 & Z1004=="MEX_2000"
replace A2038_4 =0 if A3032_D>5  & Z1004=="MEX_2000"
replace A2038_4 =0 if A3032_D==.  & Z1004=="MEX_2000"
*list A3032_D A2038_4 if Z1004=="MEX_2000"
*tab A2038_4 if Z1004=="MEX_2000"

replace A2038_5 =1 if A3032_F<5 & Z1004=="MEX_2000"
replace A2038_5 =0 if A3032_F==5 & Z1004=="MEX_2000"
replace A2038_5 =0 if A3032_F>5  & Z1004=="MEX_2000"
replace A2038_5 =0 if A3032_F==.  & Z1004=="MEX_2000"
*list A3032_E A2038_5 if Z1004=="MEX_2000"
*tab A2038_5 if Z1004=="MEX_2000"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="MEX_2000"
*tab A2038 if Z1004=="MEX_2000"

**version iii
sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="MEX_2000"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="MEX_2000"

**Party A
replace A2039_1 = A5004_A-A3032_A if Z1004=="MEX_2000"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="MEX_2000"
*tab  A2039_1 if Z1004=="MEX_2000"
***missings
sum A3032_A if Z1004=="MEX_2000"
replace A2039_1_b = A5004_A-A3032_A if Z1004=="MEX_2000"
replace A2039_1_b= A5004_A-(6.69+3.3) if A3032_A==. & Z1004=="MEX_2000"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="MEX_2000"
*tab  A2039_1_b if Z1004=="MEX_2000"

**Party B
replace A2039_2 = A5004_B-A3032_B if Z1004=="MEX_2000"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="MEX_2000"
*tab  A2039_2 if Z1004=="MEX_2000"
***missings
sum A3032_B if Z1004=="MEX_2000"
replace A2039_2_b = A5004_B-A3032_B if Z1004=="MEX_2000"
replace A2039_2_b= A5004_B-(5.37+3.6) if A3032_B==. & Z1004=="MEX_2000"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="MEX_2000"
*tab  A2039_2_b if Z1004=="MEX_2000"

**Party C
replace A2039_3 = A5004_C-A3032_C if Z1004=="MEX_2000"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="MEX_2000"
*tab  A2039_3 if Z1004=="MEX_2000"
***missings
sum A3032_C if Z1004=="MEX_2000"
replace A2039_3_b = A5004_C-A3032_C if Z1004=="MEX_2000"
replace A2039_3_b= A5004_C-(3.92+3.06) if A3032_C==. & Z1004=="MEX_2000"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="MEX_2000"
*tab  A2039_3_b if Z1004=="MEX_2000"

**Party D
replace A2039_4 = A5004_D-A3032_D if Z1004=="MEX_2000"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="MEX_2000"
*tab  A2039_4 if Z1004=="MEX_2000"
***missings
sum A3032_D if Z1004=="MEX_2000"
replace A2039_4_b = A5004_D-A3032_D if Z1004=="MEX_2000"
replace A2039_4_b= A5004_D-(3.35+2.83) if A3032_D==. & Z1004=="MEX_2000"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="MEX_2000"
*tab  A2039_4_b if Z1004=="MEX_2000"

**Party F
replace A2039_6 = A5004_F-A3032_F if Z1004=="MEX_2000"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="MEX_2000"
*tab  A2039_6 if Z1004=="MEX_2000"
***missings
sum A3032_F if Z1004=="MEX_2000"
replace A2039_6_b = A5004_F-A3032_F if Z1004=="MEX_2000"
replace A2039_6_b= A5004_F-(2.72+2.77) if A3032_F==. & Z1004=="MEX_2000"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="MEX_2000"
*tab  A2039_6_b if Z1004=="MEX_2000"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_6)/5 if Z1004=="MEX_2000"
sum  A2039 if Z1004=="MEX_2000"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_6_b)/5 if Z1004=="MEX_2000"
sum  A2039_B if Z1004=="MEX_2000"

****************************************************************************************

***PRT_2002

sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F  if Z1004=="PRT_2002"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="PRT_2002"

***strange problem
drop if A5004_F==. & Z1004=="PRT_2002"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*6 parties  to most left to most right
*fedbac
replace A2037_1 =1 if A3032_F< A3032_E & Z1004=="PRT_2002"
replace A2037_1 =0 if A3032_F> A3032_E & Z1004=="PRT_2002"
replace A2037_1 =0 if A3032_F == A3032_E & Z1004=="PRT_2002"
replace A2037_1 =0 if A3032_F ==. & Z1004=="PRT_2002"
replace A2037_1 =0 if A3032_E ==. & Z1004=="PRT_2002"
*list A2037_1 A3032_C A3032_A if Z1004=="PRT_2002"
*tab A2037_1 if Z1004=="PRT_2002"

replace A2037_2 =1 if A3032_E< A3032_D & Z1004=="PRT_2002"
replace A2037_2 =0 if A3032_E> A3032_D & Z1004=="PRT_2002"
replace A2037_2 =0 if A3032_E == A3032_D & Z1004=="PRT_2002"
replace A2037_2 =0 if A3032_E ==. & Z1004=="PRT_2002"
replace A2037_2 =0 if A3032_D ==. & Z1004=="PRT_2002"
*list A2037_2 A3032_D A3032_B if Z1004=="PRT_2002"
*tab A2037_2 if Z1004=="PRT_2002"

replace A2037_3 =1 if A3032_D< A3032_B & Z1004=="PRT_2002"
replace A2037_3 =0 if A3032_D> A3032_B & Z1004=="PRT_2002"
replace A2037_3 =0 if A3032_D == A3032_B & Z1004=="PRT_2002"
replace A2037_3 =0 if A3032_D ==. & Z1004=="PRT_2002"
replace A2037_3 =0 if A3032_B ==. & Z1004=="PRT_2002"
*list A2037_3 A3032_E A3032_F if Z1004=="PRT_2002"
*tab A2037_3 if Z1004=="PRT_2002"

replace A2037_4 =1 if A3032_B< A3032_A & Z1004=="PRT_2002"
replace A2037_4 =0 if A3032_B> A3032_A & Z1004=="PRT_2002"
replace A2037_4 =0 if A3032_B == A3032_A & Z1004=="PRT_2002" 
replace A2037_4 =0 if A3032_B ==. & Z1004=="PRT_2002"
replace A2037_4 =0 if A3032_A ==. & Z1004=="PRT_2002"
*list A2037_4 A3032_E A3032_A if Z1004=="PRT_2002" 
*tab A2037_4 if Z1004=="PRT_2002"

replace A2037_5 =1 if A3032_A< A3032_C & Z1004=="PRT_2002"
replace A2037_5 =0 if A3032_A> A3032_C & Z1004=="PRT_2002"
replace A2037_5 =0 if A3032_A == A3032_C & Z1004=="PRT_2002"
replace A2037_5 =0 if A3032_A ==. & Z1004=="PRT_2002"
replace A2037_5 =0 if A3032_C ==. & Z1004=="PRT_2002"
*list A2037_5 A3032_D A3032_E if Z1004=="PRT_2002"
*tab A2037_5 if Z1004=="PRT_2002", missing

replace A2037_6 =1 if A3032_F< A3032_C & Z1004=="PRT_2002"
replace A2037_6 =0 if A3032_F> A3032_C & Z1004=="PRT_2002"
replace A2037_6 =0 if A3032_F == A3032_C & Z1004=="PRT_2002"
replace A2037_6 =0 if A3032_F ==. & Z1004=="PRT_2002"
replace A2037_6 =0 if A3032_C ==. & Z1004=="PRT_2002"
*list A2037_5 A3032_A A3032_E if Z1004=="PRT_2002"
*tab A2037_6 if Z1004=="PRT_2002", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="PRT_2002"
*tab A2037 if Z1004=="PRT_2002"

**ii)correct placement of parties on the left-right is following the 
replace A2038_1 =0 if A3032_A<5 & Z1004=="PRT_2002"
replace A2038_1 =0 if A3032_A==5 & Z1004=="PRT_2002"
replace A2038_1 =1 if A3032_A>5  & Z1004=="PRT_2002"
replace A2038_1 =0 if A3032_A==.  & Z1004=="PRT_2002"
*tab A2038_1 if Z1004=="PRT_2002"

replace A2038_2 =0 if A3032_B>5 & Z1004=="PRT_2002"
replace A2038_2 =0 if A3032_B==5 & Z1004=="PRT_2002"
replace A2038_2 =1 if A3032_B<5  & Z1004=="PRT_2002"
replace A2038_2 =0 if A3032_B==.  & Z1004=="PRT_2002"
*tab A2038_2 if Z1004=="PRT_2002"

replace A2038_3 =1 if A3032_C>5 & Z1004=="PRT_2002"
replace A2038_3 =0 if A3032_C==5 & Z1004=="PRT_2002"
replace A2038_3 =0 if A3032_C<5  & Z1004=="PRT_2002"
replace A2038_3 =0 if A3032_C==.  & Z1004=="PRT_2002"
*tab A2038_3 if Z1004=="PRT_2002"
*list A3032_C A2038_3 if Z1004=="PRT_2002"

replace A2038_4 =1 if A3032_D<5 & Z1004=="PRT_2002"
replace A2038_4 =0 if A3032_D==5 & Z1004=="PRT_2002"
replace A2038_4 =0 if A3032_D>5  & Z1004=="PRT_2002"
replace A2038_4 =0 if A3032_D==.  & Z1004=="PRT_2002"
*list A3032_D A2038_4 if Z1004=="PRT_2002"
*tab A2038_4 if Z1004=="PRT_2002"

replace A2038_5 =1 if A3032_F<5 & Z1004=="PRT_2002"
replace A2038_5 =0 if A3032_F==5 & Z1004=="PRT_2002"
replace A2038_5 =0 if A3032_F>5  & Z1004=="PRT_2002"
replace A2038_5 =0 if A3032_F==.  & Z1004=="PRT_2002"
*list A3032_E A2038_5 if Z1004=="PRT_2002"
*tab A2038_5 if Z1004=="PRT_2002"

replace A2038_6 =1 if A3032_E<5 & Z1004=="PRT_2002"
replace A2038_6 =0 if A3032_E==5 & Z1004=="PRT_2002"
replace A2038_6 =0 if A3032_E>5  & Z1004=="PRT_2002"
replace A2038_6 =0 if A3032_E==.  & Z1004=="PRT_2002"
*list A3032_F A2038_6 if Z1004=="PRT_2002"
*tab A2038_6 if Z1004=="PRT_2002"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="PRT_2002"
*tab A2038 if Z1004=="PRT_2002"

**version iii
sum A5004_A A5004_B A5004_C A5004_D A5004_E A5004_F if Z1004=="PRT_2002"
sum A3032_A A3032_B A3032_C A3032_D A3032_E A3032_F A3032_G A3032_H A3032_I if Z1004=="PRT_2002"

**Party A
replace A2039_1 = A5004_A-A3032_A if Z1004=="PRT_2002"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="PRT_2002"
*tab  A2039_1 if Z1004=="PRT_2002"
***missings
sum A3032_A if Z1004=="PRT_2002"
replace A2039_1_b = A5004_A-A3032_A if Z1004=="PRT_2002"
replace A2039_1_b= A5004_A-(7.31+1.83) if A3032_A==. & Z1004=="PRT_2002"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="PRT_2002"
*tab  A2039_1_b if Z1004=="PRT_2002"

**Party B
replace A2039_2 = A5004_B-A3032_B if Z1004=="PRT_2002"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="PRT_2002"
*tab  A2039_2 if Z1004=="PRT_2002"
***missings
sum A3032_B if Z1004=="PRT_2002"
replace A2039_2_b = A5004_B-A3032_B if Z1004=="PRT_2002"
replace A2039_2_b= A5004_B-(4.62+1.71) if A3032_B==. & Z1004=="PRT_2002"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="PRT_2002"
*tab  A2039_2_b if Z1004=="PRT_2002"

**Party C
replace A2039_3 = A5004_C-A3032_C if Z1004=="PRT_2002"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="PRT_2002"
*tab  A2039_3 if Z1004=="PRT_2002"
***missings
sum A3032_C if Z1004=="PRT_2002"
replace A2039_3_b = A5004_C-A3032_C if Z1004=="PRT_2002"
replace A2039_3_b= A5004_C-(7.72+2.36) if A3032_C==. & Z1004=="PRT_2002"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="PRT_2002"
*tab  A2039_3_b if Z1004=="PRT_2002"

**Party D
replace A2039_4 = A5004_D-A3032_D if Z1004=="PRT_2002"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="PRT_2002"
*tab  A2039_4 if Z1004=="PRT_2002"
***missings
sum A3032_D if Z1004=="PRT_2002"
replace A2039_4_b = A5004_D-A3032_D if Z1004=="PRT_2002"
replace A2039_4_b= A5004_D-(1.91+1.58) if A3032_D==. & Z1004=="PRT_2002"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="PRT_2002"
*tab  A2039_4_b if Z1004=="PRT_2002"

**Party E
replace A5004_E=1 if Z1004=="PRT_2002"
replace A2039_5 = A5004_E-A3032_E if Z1004=="PRT_2002"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="PRT_2002"
*tab  A2039_5 if Z1004=="PRT_2002"
***missings
sum A3032_E if Z1004=="PRT_2002"
replace A2039_5_b = A5004_E-A3032_E if Z1004=="PRT_2002"
replace A2039_5_b= A5004_E-(1.72+1.56) if A3032_E==. & Z1004=="PRT_2002"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="PRT_2002"
*tab  A2039_5_b if Z1004=="PRT_2002"

**Party F
replace A2039_6 = A5004_F-A3032_F if Z1004=="PRT_2002"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="PRT_2002"
*tab  A2039_6 if Z1004=="PRT_2002"
***missings
sum A3032_F if Z1004=="PRT_2002"
replace A2039_6_b = A5004_F-A3032_F if Z1004=="PRT_2002"
replace A2039_6_b= A5004_F-(1.95+2.07) if A3032_F==. & Z1004=="PRT_2002"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="PRT_2002"
*tab  A2039_6_b if Z1004=="PRT_2002"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6)/6 if Z1004=="PRT_2002"
sum  A2039 if Z1004=="PRT_2002"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_6_b+A2039_5_b)/6 if Z1004=="PRT_2002"
sum  A2039_B if Z1004=="PRT_2002"
****************************************************************************************
***FRA_2002
sum B5018_A B5018_B B5018_C B5018_D B5018_E B5018_F B5018_G B5018_H if Z1004=="FRA_2002"


*tab B3038_A if Z1004=="FRA_2002"
*tab B3038_B if Z1004=="FRA_2002"
*tab B3038_C if Z1004=="FRA_2002"
*tab B3038_D if Z1004=="FRA_2002"

sum B3038_A B3038_B B3038_C B3038_D B3038_E B3038_F B3038_G B3038_H if Z1004=="FRA_2002"

mvdecode B3038_A, mv(98, 99), if Z1004=="FRA_2002"
mvdecode B3038_B, mv(98, 99), if Z1004=="FRA_2002"
mvdecode B3038_C, mv(98, 99), if Z1004=="FRA_2002"
mvdecode B3038_D, mv(98, 99), if Z1004=="FRA_2002"
mvdecode B3038_E, mv(98, 99), if Z1004=="FRA_2002"
mvdecode B3038_F, mv(98, 99), if Z1004=="FRA_2002"
mvdecode B3038_G, mv(98, 99), if Z1004=="FRA_2002"
mvdecode B3038_H, mv(98, 99), if Z1004=="FRA_2002"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*8 parties 
*  EFGCDAHB
replace A2037_1 =1 if B3038_E< B3038_F & Z1004=="FRA_2002"
replace A2037_1 =0 if B3038_E> B3038_F & Z1004=="FRA_2002"
replace A2037_1 =0 if B3038_E == B3038_F & Z1004=="FRA_2002"
replace A2037_1 =0 if B3038_E ==. & Z1004=="FRA_2002"
replace A2037_1 =0 if B3038_F ==. & Z1004=="FRA_2002"
*list A2037_1 B3038_C B3038_D if Z1004=="FRA_2002"
*tab A2037_1 if Z1004=="FRA_2002", miss

replace A2037_2 =0 if B3038_F< B3038_G & Z1004=="FRA_2002"
replace A2037_2 =0 if B3038_F> B3038_G & Z1004=="FRA_2002"
replace A2037_2 =1 if B3038_F == B3038_G & Z1004=="FRA_2002"
replace A2037_2 =0 if B3038_F ==. & Z1004=="FRA_2002"
replace A2037_2 =0 if B3038_G ==. & Z1004=="FRA_2002"
*list A2037_2 B3038_D B3038_A if Z1004=="FRA_2002"
*tab A2037_2 if Z1004=="FRA_2002"

replace A2037_3 =1 if B3038_G< B3038_C & Z1004=="FRA_2002"
replace A2037_3 =0 if B3038_G> B3038_C & Z1004=="FRA_2002"
replace A2037_3 =0 if B3038_G == B3038_C & Z1004=="FRA_2002"
replace A2037_3 =0 if B3038_G ==. & Z1004=="FRA_2002"
replace A2037_3 =0 if B3038_C ==. & Z1004=="FRA_2002"
*list A2037_3 B3038_A B3038_B if Z1004=="FRA_2002"
*tab A2037_3 if Z1004=="FRA_2002"

replace A2037_4 =1 if B3038_C< B3038_D & Z1004=="FRA_2002"
replace A2037_4 =0 if B3038_C> B3038_D & Z1004=="FRA_2002"
replace A2037_4 =0 if B3038_C == B3038_D & Z1004=="FRA_2002" 
replace A2037_4 =0 if B3038_D ==. & Z1004=="FRA_2002"
replace A2037_4 =0 if B3038_C ==. & Z1004=="FRA_2002"
*list A2037_4 B3038_B B3038_C if Z1004=="FRA_2002" 
*tab A2037_4 if Z1004=="FRA_2002"

replace A2037_5 =1 if B3038_D< B3038_A & Z1004=="FRA_2002"
replace A2037_5 =0 if B3038_D> B3038_A & Z1004=="FRA_2002"
replace A2037_5 =0 if B3038_D == B3038_A & Z1004=="FRA_2002"
replace A2037_5 =0 if B3038_D ==. & Z1004=="FRA_2002"
replace A2037_5 =0 if B3038_A ==. & Z1004=="FRA_2002"
*list A2037_5 B3038_C B3038_D if Z1004=="FRA_2002"
*tab A2037_5 if Z1004=="FRA_2002", missing

replace A2037_6 =0 if B3038_H< B3038_A & Z1004=="FRA_2002"
replace A2037_6 =0 if B3038_H> B3038_A & Z1004=="FRA_2002"
replace A2037_6 =1 if B3038_H == B3038_A & Z1004=="FRA_2002"
replace A2037_6 =0 if B3038_H ==. & Z1004=="FRA_2002"
replace A2037_6 =0 if B3038_A ==. & Z1004=="FRA_2002"
*list A2037_6 B3038_C B3038_D if Z1004=="FRA_2002"
*tab A2037_6 if Z1004=="FRA_2002", missing

replace A2037_7 =1 if B3038_H< B3038_B & Z1004=="FRA_2002"
replace A2037_7 =0 if B3038_H> B3038_B & Z1004=="FRA_2002"
replace A2037_7 =0 if B3038_H == B3038_B & Z1004=="FRA_2002"
replace A2037_7 =0 if B3038_H ==. & Z1004=="FRA_2002"
replace A2037_7 =0 if B3038_B ==. & Z1004=="FRA_2002"
*list A2037_7 B3038_C B3038_D if Z1004=="FRA_2002"
*tab A2037_7 if Z1004=="FRA_2002", missing

replace A2037_8 =1 if B3038_E< B3038_B & Z1004=="FRA_2002"
replace A2037_8 =0 if B3038_E> B3038_B & Z1004=="FRA_2002"
replace A2037_8 =0 if B3038_E == B3038_B & Z1004=="FRA_2002"
replace A2037_8 =0 if B3038_E ==. & Z1004=="FRA_2002"
replace A2037_8 =0 if B3038_B ==. & Z1004=="FRA_2002"
*list A2037_8 B3038_C B3038_D if Z1004=="FRA_2002"
*tab A2037_8 if Z1004=="FRA_2002", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7+A2037_8)/8 if Z1004=="FRA_2002"
*tab A2037  if Z1004=="FRA_2002"

*)correct placement of parties on the left-right is following the 
*5 parties
replace A2038_1 =1 if B3038_A>5 & Z1004=="FRA_2002"
replace A2038_1 =0 if B3038_A==5 & Z1004=="FRA_2002"
replace A2038_1 =0 if B3038_A<5  & Z1004=="FRA_2002"
replace A2038_1 =0 if B3038_A==.  & Z1004=="FRA_2002"
*tab A2038_1 if Z1004=="FRA_2002"

replace A2038_2 =1 if B3038_B>5 & Z1004=="FRA_2002"
replace A2038_2 =0 if B3038_B==5 & Z1004=="FRA_2002"
replace A2038_2 =0 if B3038_B<5  & Z1004=="FRA_2002"
replace A2038_2 =0 if B3038_B==.  & Z1004=="FRA_2002"
*list A2038_2 B3038_B if Z1004=="FRA_2002"
*tab A2038_2 if Z1004=="FRA_2002"

replace A2038_3 =1 if B3038_C<5 & Z1004=="FRA_2002"
replace A2038_3 =0 if B3038_C==5 & Z1004=="FRA_2002"
replace A2038_3 =0 if B3038_C>5  & Z1004=="FRA_2002"
replace A2038_3 =0 if B3038_C==.  & Z1004=="FRA_2002"
*tab A2038_3 if Z1004=="FRA_2002"
*list B3038_C A2038_3 if Z1004=="FRA_2002"

replace A2038_4 =0 if B3038_D<5 & Z1004=="FRA_2002"
replace A2038_4 =0 if B3038_D==5 & Z1004=="FRA_2002"
replace A2038_4 =1 if B3038_D>5  & Z1004=="FRA_2002"
replace A2038_4 =0 if B3038_D==.  & Z1004=="FRA_2002"
*list B3038_D A2038_4 if Z1004=="FRA_2002"
*tab A2038_4 if Z1004=="FRA_2002"

replace A2038_5 =1 if B3038_E<5 & Z1004=="FRA_2002"
replace A2038_5 =0 if B3038_E==5 & Z1004=="FRA_2002"
replace A2038_5 =0 if B3038_E>5  & Z1004=="FRA_2002"
replace A2038_5 =0 if B3038_E==.  & Z1004=="FRA_2002"
*list B3038_F A2038_5 if Z1004=="FRA_2002"
*tab A2038_5 if Z1004=="FRA_2002"

replace A2038_6 =1 if B3038_F<5 & Z1004=="FRA_2002"
replace A2038_6 =0 if B3038_F==5 & Z1004=="FRA_2002"
replace A2038_6 =0 if B3038_F>5  & Z1004=="FRA_2002"
replace A2038_6 =0 if B3038_F==.  & Z1004=="FRA_2002"
*list B3038_F A2038_6 if Z1004=="FRA_2002"
*tab A2038_6 if Z1004=="FRA_2002"

replace A2038_7 =1 if B3038_G<5 & Z1004=="FRA_2002"
replace A2038_7 =0 if B3038_G==5 & Z1004=="FRA_2002"
replace A2038_7 =0 if B3038_G>5  & Z1004=="FRA_2002"
replace A2038_7 =0 if B3038_G==.  & Z1004=="FRA_2002"
*list B3038_G A2038_7 if Z1004=="FRA_2002"
*tab A2038_7 if Z1004=="FRA_2002"

replace A2038_8 =0 if B3038_H<5 & Z1004=="FRA_2002"
replace A2038_8 =0 if B3038_H==5 & Z1004=="FRA_2002"
replace A2038_8 =1 if B3038_H>5  & Z1004=="FRA_2002"
replace A2038_8 =0 if B3038_H==.  & Z1004=="FRA_2002"
*list B3038_H A2038_8 if Z1004=="FRA_2002"
*tab A2038_8 if Z1004=="FRA_2002"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7+A2038_8)/8 if Z1004=="FRA_2002"
*tab A2038 if Z1004=="FRA_2002"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="FRA_2002"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="FRA_2002"
*tab  A2039_1 if Z1004=="FRA_2002"
***missings
sum B3038_A if Z1004=="FRA_2002"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="FRA_2002"
replace A2039_1_b= B5018_A-(6.66+2.32) if B3038_A==. & Z1004=="FRA_2002"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="FRA_2002"
*tab  A2039_1_b if Z1004=="FRA_2002"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="FRA_2002"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="FRA_2002"
*tab  A2039_2 if Z1004=="FRA_2002"
***missings
sum B3038_B if Z1004=="FRA_2002"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="FRA_2002"
replace A2039_2_b= B5018_B-(7.85+3.43) if B3038_B==. & Z1004=="FRA_2002"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="FRA_2002"
*tab  A2039_2_b if Z1004=="FRA_2002"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="FRA_2002"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="FRA_2002"
*tab  A2039_3 if Z1004=="FRA_2002"
***missings
sum B3038_C if Z1004=="FRA_2002"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="FRA_2002"
replace A2039_3_b= B5018_C-(3.61+2.35) if B3038_C==. & Z1004=="FRA_2002"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="FRA_2002"
*tab  A2039_3_b if Z1004=="FRA_2002"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="FRA_2002"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="FRA_2002"
*tab  A2039_4 if Z1004=="FRA_2002"
***missings
sum B3038_D if Z1004=="FRA_2002"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="FRA_2002"
replace A2039_4_b= B5018_D-(6.37+2.18) if B3038_D==. & Z1004=="FRA_2002"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="FRA_2002"
*tab  A2039_4_b if Z1004=="FRA_2002"

**Party F
replace A2039_5 = B5018_F-B3038_F if Z1004=="FRA_2002"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="FRA_2002"
*tab  A2039_5 if Z1004=="FRA_2002"
***missings
sum B3038_F if Z1004=="FRA_2002"
replace A2039_5_b = B5018_F-B3038_F if Z1004=="FRA_2002"
replace A2039_5_b= B5018_F-(4.62+2.18) if B3038_F==. & Z1004=="FRA_2002"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="FRA_2002"
*tab  A2039_5_b if Z1004=="FRA_2002"

**Party E
replace A2039_6 = B5018_E-B3038_E if Z1004=="FRA_2002"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="FRA_2002"
*tab  A2039_6 if Z1004=="FRA_2002"
***missings
sum B3038_E if Z1004=="FRA_2002"
replace A2039_6_b = B5018_E-B3038_E if Z1004=="FRA_2002"
replace A2039_6_b= B5018_E-(2.30+2.43) if B3038_E==. & Z1004=="FRA_2002"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="FRA_2002"
*tab  A2039_6_b if Z1004=="FRA_2002"

**Party G
replace A2039_7 = B5018_G-B3038_G if Z1004=="FRA_2002"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="FRA_2002"
*tab  A2039_7 if Z1004=="FRA_2002"
***missings
sum B3038_G if Z1004=="FRA_2002"
replace A2039_7_b = B5018_G-B3038_G if Z1004=="FRA_2002"
replace A2039_7_b= B5018_G-(3.59+2.04) if B3038_G==. & Z1004=="FRA_2002"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="FRA_2002"
*tab  A2039_7_b if Z1004=="FRA_2002"

**Party H
replace A2039_8 = B5018_H-B3038_H if Z1004=="FRA_2002"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="FRA_2002"
*tab  A2039_8 if Z1004=="FRA_2002"
***missings
sum B3038_H if Z1004=="FRA_2002"
replace A2039_8_b = B5018_H-B3038_H if Z1004=="FRA_2002"
replace A2039_8_b= B5018_H-(5.88+2.43) if B3038_H==. & Z1004=="FRA_2002"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="FRA_2002"
*tab  A2039_8_b if Z1004=="FRA_2002"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7+A2039_8)/8 if Z1004=="FRA_2002"
sum  A2039 if Z1004=="FRA_2002"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b+A2039_8_b)/8 if Z1004=="FRA_2002"
sum  A2039_B if Z1004=="FRA_2002"


****************************************************************************************
***ISR_2003
sum B5018_A B5018_B B5018_C B5018_D B5018_E B5018_F B5018_G B5018_H if Z1004=="ISR_2003"


*tab B3038_A if Z1004=="ISR_2003"
*tab B3038_B if Z1004=="ISR_2003"
*tab B3038_C if Z1004=="ISR_2003"
*tab B3038_D if Z1004=="ISR_2003"

sum B3038_A B3038_B B3038_C B3038_D B3038_E B3038_F B3038_G B3038_H if Z1004=="ISR_2003"

mvdecode B3038_A, mv(98, 99), if Z1004=="ISR_2003"
mvdecode B3038_B, mv(98, 99), if Z1004=="ISR_2003"
mvdecode B3038_C, mv(98, 99), if Z1004=="ISR_2003"
mvdecode B3038_D, mv(98, 99), if Z1004=="ISR_2003"
mvdecode B3038_E, mv(98, 99), if Z1004=="ISR_2003"
mvdecode B3038_F, mv(98, 99), if Z1004=="ISR_2003"
mvdecode B3038_G, mv(98, 99), if Z1004=="ISR_2003"
mvdecode B3038_H, mv(98, 99), if Z1004=="ISR_2003"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*6 parties 
*  FBCADE
replace A2037_1 =1 if B3038_F< B3038_B & Z1004=="ISR_2003"
replace A2037_1 =0 if B3038_F> B3038_B & Z1004=="ISR_2003"
replace A2037_1 =0 if B3038_F == B3038_B & Z1004=="ISR_2003"
replace A2037_1 =0 if B3038_F ==. & Z1004=="ISR_2003"
replace A2037_1 =0 if B3038_B ==. & Z1004=="ISR_2003"
*list A2037_1 B3038_C B3038_D if Z1004=="ISR_2003"
*tab A2037_1 if Z1004=="ISR_2003", miss

replace A2037_2 =1 if B3038_B< B3038_C & Z1004=="ISR_2003"
replace A2037_2 =0 if B3038_B> B3038_C & Z1004=="ISR_2003"
replace A2037_2 =0 if B3038_B == B3038_C & Z1004=="ISR_2003"
replace A2037_2 =0 if B3038_B ==. & Z1004=="ISR_2003"
replace A2037_2 =0 if B3038_C ==. & Z1004=="ISR_2003"
*list A2037_2 B3038_D B3038_A if Z1004=="ISR_2003"
*tab A2037_2 if Z1004=="ISR_2003"

replace A2037_3 =1 if B3038_C< B3038_A & Z1004=="ISR_2003"
replace A2037_3 =0 if B3038_C> B3038_A & Z1004=="ISR_2003"
replace A2037_3 =0 if B3038_C == B3038_A & Z1004=="ISR_2003"
replace A2037_3 =0 if B3038_C ==. & Z1004=="ISR_2003"
replace A2037_3 =0 if B3038_A ==. & Z1004=="ISR_2003"
*list A2037_3 B3038_A B3038_B if Z1004=="ISR_2003"
*tab A2037_3 if Z1004=="ISR_2003"

replace A2037_4 =1 if B3038_A< B3038_D & Z1004=="ISR_2003"
replace A2037_4 =0 if B3038_A> B3038_D & Z1004=="ISR_2003"
replace A2037_4 =0 if B3038_A == B3038_D & Z1004=="ISR_2003" 
replace A2037_4 =0 if B3038_A ==. & Z1004=="ISR_2003"
replace A2037_4 =0 if B3038_D ==. & Z1004=="ISR_2003"
*list A2037_4 B3038_B B3038_C if Z1004=="ISR_2003" 
*tab A2037_4 if Z1004=="ISR_2003"

replace A2037_5 =1 if B3038_D< B3038_E & Z1004=="ISR_2003"
replace A2037_5 =0 if B3038_D> B3038_E & Z1004=="ISR_2003"
replace A2037_5 =0 if B3038_D == B3038_E & Z1004=="ISR_2003"
replace A2037_5 =0 if B3038_D ==. & Z1004=="ISR_2003"
replace A2037_5 =0 if B3038_E ==. & Z1004=="ISR_2003"
*list A2037_5 B3038_C B3038_D if Z1004=="ISR_2003"
*tab A2037_5 if Z1004=="ISR_2003", missing

replace A2037_6 =1 if B3038_F< B3038_E & Z1004=="ISR_2003"
replace A2037_6 =0 if B3038_F> B3038_E & Z1004=="ISR_2003"
replace A2037_6 =0 if B3038_F == B3038_E & Z1004=="ISR_2003"
replace A2037_6 =0 if B3038_F ==. & Z1004=="ISR_2003"
replace A2037_6 =0 if B3038_E ==. & Z1004=="ISR_2003"
*list A2037_6 B3038_C B3038_D if Z1004=="ISR_2003"
*tab A2037_6 if Z1004=="ISR_2003", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="ISR_2003"
*tab A2037  if Z1004=="ISR_2003"

*)correct placement of parties on the left-right is following the 
*5 parties
replace A2038_1 =1 if B3038_A>5 & Z1004=="ISR_2003"
replace A2038_1 =0 if B3038_A==5 & Z1004=="ISR_2003"
replace A2038_1 =0 if B3038_A<5  & Z1004=="ISR_2003"
replace A2038_1 =0 if B3038_A==.  & Z1004=="ISR_2003"
*tab A2038_1 if Z1004=="ISR_2003"

replace A2038_2 =0 if B3038_B>5 & Z1004=="ISR_2003"
replace A2038_2 =0 if B3038_B==5 & Z1004=="ISR_2003"
replace A2038_2 =1 if B3038_B<5  & Z1004=="ISR_2003"
replace A2038_2 =0 if B3038_B==.  & Z1004=="ISR_2003"
*list A2038_2 B3038_B if Z1004=="ISR_2003"
*tab A2038_2 if Z1004=="ISR_2003"

replace A2038_3 =0 if B3038_C<5 & Z1004=="ISR_2003"
replace A2038_3 =1 if B3038_C==5 & Z1004=="ISR_2003"
replace A2038_3 =0 if B3038_C>5  & Z1004=="ISR_2003"
replace A2038_3 =0 if B3038_C==.  & Z1004=="ISR_2003"
*tab A2038_3 if Z1004=="ISR_2003"
*list B3038_C A2038_3 if Z1004=="ISR_2003"

replace A2038_4 =0 if B3038_D<5 & Z1004=="ISR_2003"
replace A2038_4 =0 if B3038_D==5 & Z1004=="ISR_2003"
replace A2038_4 =1 if B3038_D>5  & Z1004=="ISR_2003"
replace A2038_4 =0 if B3038_D==.  & Z1004=="ISR_2003"
*list B3038_D A2038_4 if Z1004=="ISR_2003"
*tab A2038_4 if Z1004=="ISR_2003"

replace A2038_5 =0 if B3038_E<5 & Z1004=="ISR_2003"
replace A2038_5 =0 if B3038_E==5 & Z1004=="ISR_2003"
replace A2038_5 =1 if B3038_E>5  & Z1004=="ISR_2003"
replace A2038_5 =0 if B3038_E==.  & Z1004=="ISR_2003"
*list B3038_F A2038_5 if Z1004=="ISR_2003"
*tab A2038_5 if Z1004=="ISR_2003"

replace A2038_6 =1 if B3038_F<5 & Z1004=="ISR_2003"
replace A2038_6 =0 if B3038_F==5 & Z1004=="ISR_2003"
replace A2038_6 =0 if B3038_F>5  & Z1004=="ISR_2003"
replace A2038_6 =0 if B3038_F==.  & Z1004=="ISR_2003"
*list B3038_F A2038_6 if Z1004=="ISR_2003"
*tab A2038_6 if Z1004=="ISR_2003"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="ISR_2003"
*tab A2038 if Z1004=="ISR_2003"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="ISR_2003"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="ISR_2003"
*tab  A2039_1 if Z1004=="ISR_2003"
***missings
sum B3038_A if Z1004=="ISR_2003"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="ISR_2003"
replace A2039_1_b= B5018_A-(7.75+1.96) if B3038_A==. & Z1004=="ISR_2003"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="ISR_2003"
*tab  A2039_1_b if Z1004=="ISR_2003"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="ISR_2003"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="ISR_2003"
*tab  A2039_2 if Z1004=="ISR_2003"
***missings
sum B3038_B if Z1004=="ISR_2003"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="ISR_2003"
replace A2039_2_b= B5018_B-(2.88+2.18) if B3038_B==. & Z1004=="ISR_2003"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="ISR_2003"
*tab  A2039_2_b if Z1004=="ISR_2003"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="ISR_2003"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="ISR_2003"
*tab  A2039_3 if Z1004=="ISR_2003"
***missings
sum B3038_C if Z1004=="ISR_2003"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="ISR_2003"
replace A2039_3_b= B5018_C-(4.88+2.33) if B3038_C==. & Z1004=="ISR_2003"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="ISR_2003"
*tab  A2039_3_b if Z1004=="ISR_2003"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="ISR_2003"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="ISR_2003"
*tab  A2039_4 if Z1004=="ISR_2003"
***missings
sum B3038_D if Z1004=="ISR_2003"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="ISR_2003"
replace A2039_4_b= B5018_D-(7+2.35) if B3038_D==. & Z1004=="ISR_2003"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="ISR_2003"
*tab  A2039_4_b if Z1004=="ISR_2003"

**Party F
replace A2039_5 = B5018_F-B3038_F if Z1004=="ISR_2003"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="ISR_2003"
*tab  A2039_5 if Z1004=="ISR_2003"
***missings
sum B3038_F if Z1004=="ISR_2003"
replace A2039_5_b = B5018_F-B3038_F if Z1004=="ISR_2003"
replace A2039_5_b= B5018_F-(1.76+1.95) if B3038_F==. & Z1004=="ISR_2003"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="ISR_2003"
*tab  A2039_5_b if Z1004=="ISR_2003"

**Party E
replace A2039_6 = B5018_E-B3038_E if Z1004=="ISR_2003"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="ISR_2003"
*tab  A2039_6 if Z1004=="ISR_2003"
***missings
sum B3038_E if Z1004=="ISR_2003"
replace A2039_6_b = B5018_E-B3038_E if Z1004=="ISR_2003"
replace A2039_6_b= B5018_E-(8.24+2.5) if B3038_E==. & Z1004=="ISR_2003"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="ISR_2003"
*tab  A2039_6_b if Z1004=="ISR_2003"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6)/6 if Z1004=="ISR_2003"
sum  A2039 if Z1004=="ISR_2003"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b)/6 if Z1004=="ISR_2003"
sum  A2039_B if Z1004=="ISR_2003"

****************************************************************************************
***NLD_2002
sum B5018_A B5018_B B5018_C B5018_D B5018_E B5018_F B5018_G B5018_H if Z1004=="NLD_2002"


*tab B3038_A if Z1004=="NLD_2002"
*tab B3038_B if Z1004=="NLD_2002"
*tab B3038_C if Z1004=="NLD_2002"
*tab B3038_D if Z1004=="NLD_2002"

sum B3038_A B3038_B B3038_C B3038_D B3038_E B3038_F B3038_G B3038_H if Z1004=="NLD_2002"

mvdecode B3038_A, mv(97, 98, 99), if Z1004=="NLD_2002"
mvdecode B3038_B, mv(97, 98, 99), if Z1004=="NLD_2002"
mvdecode B3038_C, mv(97, 98, 99), if Z1004=="NLD_2002"
mvdecode B3038_D, mv(97, 98, 99), if Z1004=="NLD_2002"
mvdecode B3038_E, mv(97, 98, 99), if Z1004=="NLD_2002"
mvdecode B3038_F, mv(97, 98, 99), if Z1004=="NLD_2002"
mvdecode B3038_G, mv(97, 98, 99), if Z1004=="NLD_2002"
mvdecode B3038_H, mv(97, 98, 99), if Z1004=="NLD_2002"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*6 parties 
*  FEDGABGH
replace A2037_1 =1 if B3038_F< B3038_E & Z1004=="NLD_2002"
replace A2037_1 =0 if B3038_F> B3038_E & Z1004=="NLD_2002"
replace A2037_1 =0 if B3038_F == B3038_E & Z1004=="NLD_2002"
replace A2037_1 =0 if B3038_F ==. & Z1004=="NLD_2002"
replace A2037_1 =0 if B3038_E ==. & Z1004=="NLD_2002"
*list A2037_1 B3038_C B3038_D if Z1004=="NLD_2002"
*tab A2037_1 if Z1004=="NLD_2002", miss

replace A2037_2 =1 if B3038_E< B3038_D & Z1004=="NLD_2002"
replace A2037_2 =0 if B3038_E> B3038_D & Z1004=="NLD_2002"
replace A2037_2 =0 if B3038_E == B3038_D & Z1004=="NLD_2002"
replace A2037_2 =0 if B3038_E ==. & Z1004=="NLD_2002"
replace A2037_2 =0 if B3038_D ==. & Z1004=="NLD_2002"
*list A2037_2 B3038_D B3038_A if Z1004=="NLD_2002"
*tab A2037_2 if Z1004=="NLD_2002"

replace A2037_3 =0 if B3038_D< B3038_G & Z1004=="NLD_2002"
replace A2037_3 =0 if B3038_D> B3038_G & Z1004=="NLD_2002"
replace A2037_3 =1 if B3038_D == B3038_G & Z1004=="NLD_2002"
replace A2037_3 =0 if B3038_D ==. & Z1004=="NLD_2002"
replace A2037_3 =0 if B3038_G ==. & Z1004=="NLD_2002"
*list A2037_3 B3038_A B3038_B if Z1004=="NLD_2002"
*tab A2037_3 if Z1004=="NLD_2002"

replace A2037_4 =1 if B3038_G< B3038_A & Z1004=="NLD_2002"
replace A2037_4 =0 if B3038_G> B3038_A & Z1004=="NLD_2002"
replace A2037_4 =0 if B3038_G == B3038_A & Z1004=="NLD_2002" 
replace A2037_4 =0 if B3038_G ==. & Z1004=="NLD_2002"
replace A2037_4 =0 if B3038_A ==. & Z1004=="NLD_2002"
*list A2037_4 B3038_B B3038_C if Z1004=="NLD_2002" 
*tab A2037_4 if Z1004=="NLD_2002"

replace A2037_5 =1 if B3038_A< B3038_B & Z1004=="NLD_2002"
replace A2037_5 =0 if B3038_A> B3038_B & Z1004=="NLD_2002"
replace A2037_5 =0 if B3038_A == B3038_B & Z1004=="NLD_2002"
replace A2037_5 =0 if B3038_A ==. & Z1004=="NLD_2002"
replace A2037_5 =0 if B3038_B ==. & Z1004=="NLD_2002"
*list A2037_5 B3038_C B3038_D if Z1004=="NLD_2002"
*tab A2037_5 if Z1004=="NLD_2002", missing

replace A2037_6 =0 if B3038_B< B3038_C & Z1004=="NLD_2002"
replace A2037_6 =0 if B3038_B> B3038_C & Z1004=="NLD_2002"
replace A2037_6 =1 if B3038_B == B3038_C & Z1004=="NLD_2002"
replace A2037_6 =0 if B3038_B ==. & Z1004=="NLD_2002"
replace A2037_6 =0 if B3038_C ==. & Z1004=="NLD_2002"
*list A2037_6 B3038_C B3038_D if Z1004=="NLD_2002"
*tab A2037_6 if Z1004=="NLD_2002", missing

replace A2037_7 =1 if B3038_C< B3038_H & Z1004=="NLD_2002"
replace A2037_7 =0 if B3038_C> B3038_H & Z1004=="NLD_2002"
replace A2037_7 =0 if B3038_C == B3038_H & Z1004=="NLD_2002"
replace A2037_7 =0 if B3038_C ==. & Z1004=="NLD_2002"
replace A2037_7 =0 if B3038_H ==. & Z1004=="NLD_2002"
*list A2037_7 B3038_C B3038_D if Z1004=="NLD_2002"
*tab A2037_7 if Z1004=="NLD_2002", missing

replace A2037_8 =1 if B3038_F< B3038_H & Z1004=="NLD_2002"
replace A2037_8 =0 if B3038_F> B3038_H & Z1004=="NLD_2002"
replace A2037_8 =0 if B3038_F == B3038_H & Z1004=="NLD_2002"
replace A2037_8 =0 if B3038_F ==. & Z1004=="NLD_2002"
replace A2037_8 =0 if B3038_H ==. & Z1004=="NLD_2002"
*list A2037_8 B3038_C B3038_D if Z1004=="NLD_2002"
*tab A2037_8 if Z1004=="NLD_2002", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7+A2037_8)/8 if Z1004=="NLD_2002"
*tab A2037  if Z1004=="NLD_2002"

*)correct placement of parties on the left-right is following the 
*5 parties
replace A2038_1 =1 if B3038_A>5 & Z1004=="NLD_2002"
replace A2038_1 =0 if B3038_A==5 & Z1004=="NLD_2002"
replace A2038_1 =0 if B3038_A<5  & Z1004=="NLD_2002"
replace A2038_1 =0 if B3038_A==.  & Z1004=="NLD_2002"
*tab A2038_1 if Z1004=="NLD_2002"

replace A2038_2 =1 if B3038_B>5 & Z1004=="NLD_2002"
replace A2038_2 =0 if B3038_B==5 & Z1004=="NLD_2002"
replace A2038_2 =0 if B3038_B<5  & Z1004=="NLD_2002"
replace A2038_2 =0 if B3038_B==.  & Z1004=="NLD_2002"
*list A2038_2 B3038_B if Z1004=="NLD_2002"
*tab A2038_2 if Z1004=="NLD_2002"

replace A2038_3 =0 if B3038_C<5 & Z1004=="NLD_2002"
replace A2038_3 =0 if B3038_C==5 & Z1004=="NLD_2002"
replace A2038_3 =1 if B3038_C>5  & Z1004=="NLD_2002"
replace A2038_3 =0 if B3038_C==.  & Z1004=="NLD_2002"
*tab A2038_3 if Z1004=="NLD_2002"
*list B3038_C A2038_3 if Z1004=="NLD_2002"

replace A2038_4 =0 if B3038_D<5 & Z1004=="NLD_2002"
replace A2038_4 =1 if B3038_D==5 & Z1004=="NLD_2002"
replace A2038_4 =0 if B3038_D>5  & Z1004=="NLD_2002"
replace A2038_4 =0 if B3038_D==.  & Z1004=="NLD_2002"
*list B3038_D A2038_4 if Z1004=="NLD_2002"
*tab A2038_4 if Z1004=="NLD_2002"

replace A2038_5 =1 if B3038_E<5 & Z1004=="NLD_2002"
replace A2038_5 =0 if B3038_E==5 & Z1004=="NLD_2002"
replace A2038_5 =0 if B3038_E>5  & Z1004=="NLD_2002"
replace A2038_5 =0 if B3038_E==.  & Z1004=="NLD_2002"
*list B3038_F A2038_5 if Z1004=="NLD_2002"
*tab A2038_5 if Z1004=="NLD_2002"

replace A2038_6 =1 if B3038_F<5 & Z1004=="NLD_2002"
replace A2038_6 =0 if B3038_F==5 & Z1004=="NLD_2002"
replace A2038_6 =0 if B3038_F>5  & Z1004=="NLD_2002"
replace A2038_6 =0 if B3038_F==.  & Z1004=="NLD_2002"
*list B3038_F A2038_6 if Z1004=="NLD_2002"
*tab A2038_6 if Z1004=="NLD_2002"

replace A2038_7 =0 if B3038_G<5 & Z1004=="NLD_2002"
replace A2038_7 =1 if B3038_G==5 & Z1004=="NLD_2002"
replace A2038_7 =0 if B3038_G>5  & Z1004=="NLD_2002"
replace A2038_7 =0 if B3038_G==.  & Z1004=="NLD_2002"
*list B3038_G A2038_7 if Z1004=="NLD_2002"
*tab A2038_7 if Z1004=="NLD_2002"

replace A2038_8 =0 if B3038_H<5 & Z1004=="NLD_2002"
replace A2038_8 =0 if B3038_H==5 & Z1004=="NLD_2002"
replace A2038_8 =1 if B3038_H>5  & Z1004=="NLD_2002"
replace A2038_8 =0 if B3038_H==.  & Z1004=="NLD_2002"
*list B3038_H A2038_8 if Z1004=="NLD_2002"
*tab A2038_8 if Z1004=="NLD_2002"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7+A2038_8)/8 if Z1004=="NLD_2002"
*tab A2038 if Z1004=="NLD_2002"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="NLD_2002"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="NLD_2002"
*tab  A2039_1 if Z1004=="NLD_2002"
***missings
sum B3038_A if Z1004=="NLD_2002"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="NLD_2002"
replace A2039_1_b= B5018_A-(6.3+1.5) if B3038_A==. & Z1004=="NLD_2002"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="NLD_2002"
*tab  A2039_1_b if Z1004=="NLD_2002"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="NLD_2002"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="NLD_2002"
*tab  A2039_2 if Z1004=="NLD_2002"
***missings
sum B3038_B if Z1004=="NLD_2002"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="NLD_2002"
replace A2039_2_b= B5018_B-(7.56+1.96) if B3038_B==. & Z1004=="NLD_2002"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="NLD_2002"
*tab  A2039_2_b if Z1004=="NLD_2002"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="NLD_2002"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="NLD_2002"
*tab  A2039_3 if Z1004=="NLD_2002"
***missings
sum B3038_C if Z1004=="NLD_2002"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="NLD_2002"
replace A2039_3_b= B5018_C-(7+1.7) if B3038_C==. & Z1004=="NLD_2002"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="NLD_2002"
*tab  A2039_3_b if Z1004=="NLD_2002"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="NLD_2002"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="NLD_2002"
*tab  A2039_4 if Z1004=="NLD_2002"
***missings
sum B3038_D if Z1004=="NLD_2002"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="NLD_2002"
replace A2039_4_b= B5018_D-(3.4+1.6) if B3038_D==. & Z1004=="NLD_2002"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="NLD_2002"
*tab  A2039_4_b if Z1004=="NLD_2002"

**Party F
replace A2039_5 = B5018_F-B3038_F if Z1004=="NLD_2002"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="NLD_2002"
*tab  A2039_5 if Z1004=="NLD_2002"
***missings
sum B3038_F if Z1004=="NLD_2002"
replace A2039_5_b = B5018_F-B3038_F if Z1004=="NLD_2002"
replace A2039_5_b= B5018_F-(2.4+1.9) if B3038_F==. & Z1004=="NLD_2002"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="NLD_2002"
*tab  A2039_5_b if Z1004=="NLD_2002"

**Party E
replace A2039_6 = B5018_E-B3038_E if Z1004=="NLD_2002"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="NLD_2002"
*tab  A2039_6 if Z1004=="NLD_2002"
***missings
sum B3038_E if Z1004=="NLD_2002"
replace A2039_6_b = B5018_E-B3038_E if Z1004=="NLD_2002"
replace A2039_6_b= B5018_E-(2.3+1.47) if B3038_E==. & Z1004=="NLD_2002"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="NLD_2002"
*tab  A2039_6_b if Z1004=="NLD_2002"

**Party G
replace A2039_7 = B5018_G-B3038_G if Z1004=="NLD_2002"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="NLD_2002"
*tab  A2039_7 if Z1004=="NLD_2002"
***missings
sum B3038_G if Z1004=="NLD_2002"
replace A2039_7_b = B5018_G-B3038_G if Z1004=="NLD_2002"
replace A2039_7_b= B5018_G-(4.4+1.54) if B3038_G==. & Z1004=="NLD_2002"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="NLD_2002"
*tab  A2039_7_b if Z1004=="NLD_2002"

**Party H
replace A2039_8 = B5018_H-B3038_H if Z1004=="NLD_2002"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="NLD_2002"
*tab  A2039_8 if Z1004=="NLD_2002"
***missings
sum B3038_H if Z1004=="NLD_2002"
replace A2039_8_b = B5018_H-B3038_H if Z1004=="NLD_2002"
replace A2039_8_b= B5018_H-(6.57+2.1) if B3038_H==. & Z1004=="NLD_2002"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="NLD_2002"
*tab  A2039_8_b if Z1004=="NLD_2002"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7+A2039_8)/8 if Z1004=="NLD_2002"
sum  A2039 if Z1004=="NLD_2002"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b+A2039_8_b)/8 if Z1004=="NLD_2002"
sum  A2039_B if Z1004=="NLD_2002"

****************************************************************************************
***NZL_2002
sum B5018_A B5018_B B5018_C B5018_D B5018_E B5018_F B5018_G B5018_H if Z1004=="NZL_2002"


*tab B3038_A if Z1004=="NZL_2002"
*tab B3038_B if Z1004=="NZL_2002"
*tab B3038_C if Z1004=="NZL_2002"
*tab B3038_D if Z1004=="NZL_2002"

sum B3038_A B3038_B B3038_C B3038_D B3038_E B3038_F B3038_G B3038_H if Z1004=="NZL_2002"

mvdecode B3038_A, mv(97, 98, 99), if Z1004=="NZL_2002"
mvdecode B3038_B, mv(97, 98, 99), if Z1004=="NZL_2002"
mvdecode B3038_C, mv(97, 98, 99), if Z1004=="NZL_2002"
mvdecode B3038_D, mv(97, 98, 99), if Z1004=="NZL_2002"
mvdecode B3038_E, mv(97, 98, 99), if Z1004=="NZL_2002"
mvdecode B3038_F, mv(97, 98, 99), if Z1004=="NZL_2002"
mvdecode B3038_G, mv(97, 98, 99), if Z1004=="NZL_2002"
mvdecode B3038_H, mv(97, 98, 99), if Z1004=="NZL_2002"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*8 parties 
*  HEGAFCBD
replace A2037_1 =1 if B3038_H< B3038_E & Z1004=="NZL_2002"
replace A2037_1 =0 if B3038_H> B3038_E & Z1004=="NZL_2002"
replace A2037_1 =0 if B3038_H == B3038_E & Z1004=="NZL_2002"
replace A2037_1 =0 if B3038_H ==. & Z1004=="NZL_2002"
replace A2037_1 =0 if B3038_E ==. & Z1004=="NZL_2002"
*list A2037_1 B3038_C B3038_D if Z1004=="NZL_2002"
*tab A2037_1 if Z1004=="NZL_2002", miss

replace A2037_2 =1 if B3038_E< B3038_G & Z1004=="NZL_2002"
replace A2037_2 =0 if B3038_E> B3038_G & Z1004=="NZL_2002"
replace A2037_2 =0 if B3038_E == B3038_G & Z1004=="NZL_2002"
replace A2037_2 =0 if B3038_E ==. & Z1004=="NZL_2002"
replace A2037_2 =0 if B3038_G ==. & Z1004=="NZL_2002"
*list A2037_2 B3038_E B3038_G if Z1004=="NZL_2002"
*tab A2037_2 if Z1004=="NZL_2002"

replace A2037_3 =0 if B3038_A< B3038_G & Z1004=="NZL_2002"
replace A2037_3 =0 if B3038_A> B3038_G & Z1004=="NZL_2002"
replace A2037_3 =1 if B3038_A == B3038_G & Z1004=="NZL_2002"
replace A2037_3 =0 if B3038_A ==. & Z1004=="NZL_2002"
replace A2037_3 =0 if B3038_G ==. & Z1004=="NZL_2002"
*list A2037_3 B3038_A B3038_B if Z1004=="NZL_2002"
*tab A2037_3 if Z1004=="NZL_2002"

replace A2037_4 =1 if B3038_A< B3038_F & Z1004=="NZL_2002"
replace A2037_4 =0 if B3038_A> B3038_F & Z1004=="NZL_2002"
replace A2037_4 =0 if B3038_A == B3038_F & Z1004=="NZL_2002" 
replace A2037_4 =0 if B3038_A ==. & Z1004=="NZL_2002"
replace A2037_4 =0 if B3038_F ==. & Z1004=="NZL_2002"
*list A2037_4 B3038_B B3038_C if Z1004=="NZL_2002" 
*tab A2037_4 if Z1004=="NZL_2002"

replace A2037_5 =0 if B3038_F< B3038_C & Z1004=="NZL_2002"
replace A2037_5 =0 if B3038_F> B3038_C & Z1004=="NZL_2002"
replace A2037_5 =1 if B3038_F == B3038_C & Z1004=="NZL_2002"
replace A2037_5 =0 if B3038_F ==. & Z1004=="NZL_2002"
replace A2037_5 =0 if B3038_C ==. & Z1004=="NZL_2002"
*list A2037_5 B3038_C B3038_D if Z1004=="NZL_2002"
*tab A2037_5 if Z1004=="NZL_2002", missing

replace A2037_6 =0 if B3038_B< B3038_C & Z1004=="NZL_2002"
replace A2037_6 =1 if B3038_B> B3038_C & Z1004=="NZL_2002"
replace A2037_6 =0 if B3038_B == B3038_C & Z1004=="NZL_2002"
replace A2037_6 =0 if B3038_B ==. & Z1004=="NZL_2002"
replace A2037_6 =0 if B3038_C ==. & Z1004=="NZL_2002"
*list A2037_6 B3038_C B3038_D if Z1004=="NZL_2002"
*tab A2037_6 if Z1004=="NZL_2002", missing

replace A2037_7 =1 if B3038_B< B3038_D & Z1004=="NZL_2002"
replace A2037_7 =0 if B3038_B> B3038_D & Z1004=="NZL_2002"
replace A2037_7 =0 if B3038_B == B3038_D & Z1004=="NZL_2002"
replace A2037_7 =0 if B3038_B ==. & Z1004=="NZL_2002"
replace A2037_7 =0 if B3038_D ==. & Z1004=="NZL_2002"
*list A2037_7 B3038_C B3038_D if Z1004=="NZL_2002"
*tab A2037_7 if Z1004=="NZL_2002", missing

replace A2037_8 =1 if B3038_H< B3038_D & Z1004=="NZL_2002"
replace A2037_8 =0 if B3038_H> B3038_D & Z1004=="NZL_2002"
replace A2037_8 =0 if B3038_H == B3038_D & Z1004=="NZL_2002"
replace A2037_8 =0 if B3038_H ==. & Z1004=="NZL_2002"
replace A2037_8 =0 if B3038_D ==. & Z1004=="NZL_2002"
*list A2037_8 B3038_C B3038_D if Z1004=="NZL_2002"
*tab A2037_8 if Z1004=="NZL_2002", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7+A2037_8)/8 if Z1004=="NZL_2002"
*tab A2037  if Z1004=="NZL_2002"

*)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =0 if B3038_A>5 & Z1004=="NZL_2002"
replace A2038_1 =0 if B3038_A==5 & Z1004=="NZL_2002"
replace A2038_1 =1 if B3038_A<5  & Z1004=="NZL_2002"
replace A2038_1 =0 if B3038_A==.  & Z1004=="NZL_2002"
*tab A2038_1 if Z1004=="NZL_2002"

replace A2038_2 =1 if B3038_B>5 & Z1004=="NZL_2002"
replace A2038_2 =0 if B3038_B==5 & Z1004=="NZL_2002"
replace A2038_2 =0 if B3038_B<5  & Z1004=="NZL_2002"
replace A2038_2 =0 if B3038_B==.  & Z1004=="NZL_2002"
*list A2038_2 B3038_B if Z1004=="NZL_2002"
*tab A2038_2 if Z1004=="NZL_2002"

replace A2038_3 =0 if B3038_C<5 & Z1004=="NZL_2002"
replace A2038_3 =0 if B3038_C==5 & Z1004=="NZL_2002"
replace A2038_3 =1 if B3038_C>5  & Z1004=="NZL_2002"
replace A2038_3 =0 if B3038_C==.  & Z1004=="NZL_2002"
*tab A2038_3 if Z1004=="NZL_2002"
*list B3038_C A2038_3 if Z1004=="NZL_2002"

replace A2038_4 =0 if B3038_D<5 & Z1004=="NZL_2002"
replace A2038_4 =0 if B3038_D==5 & Z1004=="NZL_2002"
replace A2038_4 =1 if B3038_D>5  & Z1004=="NZL_2002"
replace A2038_4 =0 if B3038_D==.  & Z1004=="NZL_2002"
*list B3038_D A2038_4 if Z1004=="NZL_2002"
*tab A2038_4 if Z1004=="NZL_2002"

replace A2038_5 =1 if B3038_E<5 & Z1004=="NZL_2002"
replace A2038_5 =0 if B3038_E==5 & Z1004=="NZL_2002"
replace A2038_5 =0 if B3038_E>5  & Z1004=="NZL_2002"
replace A2038_5 =0 if B3038_E==.  & Z1004=="NZL_2002"
*list B3038_F A2038_5 if Z1004=="NZL_2002"
*tab A2038_5 if Z1004=="NZL_2002"

replace A2038_6 =0 if B3038_F<5 & Z1004=="NZL_2002"
replace A2038_6 =0 if B3038_F==5 & Z1004=="NZL_2002"
replace A2038_6 =1 if B3038_F>5  & Z1004=="NZL_2002"
replace A2038_6 =0 if B3038_F==.  & Z1004=="NZL_2002"
*list B3038_F A2038_6 if Z1004=="NZL_2002"
*tab A2038_6 if Z1004=="NZL_2002"

replace A2038_7 =1 if B3038_G<5 & Z1004=="NZL_2002"
replace A2038_7 =0 if B3038_G==5 & Z1004=="NZL_2002"
replace A2038_7 =0 if B3038_G>5  & Z1004=="NZL_2002"
replace A2038_7 =0 if B3038_G==.  & Z1004=="NZL_2002"
*list B3038_G A2038_7 if Z1004=="NZL_2002"
*tab A2038_7 if Z1004=="NZL_2002"

replace A2038_8 =1 if B3038_H<5 & Z1004=="NZL_2002"
replace A2038_8 =0 if B3038_H==5 & Z1004=="NZL_2002"
replace A2038_8 =0 if B3038_H>5  & Z1004=="NZL_2002"
replace A2038_8 =0 if B3038_H==.  & Z1004=="NZL_2002"
*list B3038_H A2038_8 if Z1004=="NZL_2002"
*tab A2038_8 if Z1004=="NZL_2002"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7+A2038_8)/8 if Z1004=="NZL_2002"
*tab A2038 if Z1004=="NZL_2002"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="NZL_2002"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="NZL_2002"
*tab  A2039_1 if Z1004=="NZL_2002"
***missings
sum B3038_A if Z1004=="NZL_2002"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="NZL_2002"
replace A2039_1_b= B5018_A-(3.96+2.6) if B3038_A==. & Z1004=="NZL_2002"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="NZL_2002"
*tab  A2039_1_b if Z1004=="NZL_2002"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="NZL_2002"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="NZL_2002"
*tab  A2039_2 if Z1004=="NZL_2002"
***missings
sum B3038_B if Z1004=="NZL_2002"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="NZL_2002"
replace A2039_2_b= B5018_B-(6.85+2.38) if B3038_B==. & Z1004=="NZL_2002"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="NZL_2002"
*tab  A2039_2_b if Z1004=="NZL_2002"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="NZL_2002"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="NZL_2002"
*tab  A2039_3 if Z1004=="NZL_2002"
***missings
sum B3038_C if Z1004=="NZL_2002"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="NZL_2002"
replace A2039_3_b= B5018_C-(6.48+2.3) if B3038_C==. & Z1004=="NZL_2002"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="NZL_2002"
*tab  A2039_3_b if Z1004=="NZL_2002"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="NZL_2002"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="NZL_2002"
*tab  A2039_4 if Z1004=="NZL_2002"
***missings
sum B3038_D if Z1004=="NZL_2002"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="NZL_2002"
replace A2039_4_b= B5018_D-(4.3+2.8) if B3038_D==. & Z1004=="NZL_2002"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="NZL_2002"
*tab  A2039_4_b if Z1004=="NZL_2002"

**Party F
replace A2039_5 = B5018_F-B3038_F if Z1004=="NZL_2002"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="NZL_2002"
*tab  A2039_5 if Z1004=="NZL_2002"
***missings
sum B3038_F if Z1004=="NZL_2002"
replace A2039_5_b = B5018_F-B3038_F if Z1004=="NZL_2002"
replace A2039_5_b= B5018_F-(5.6+2.07) if B3038_F==. & Z1004=="NZL_2002"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="NZL_2002"
*tab  A2039_5_b if Z1004=="NZL_2002"

**Party E
replace A2039_6 = B5018_E-B3038_E if Z1004=="NZL_2002"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="NZL_2002"
*tab  A2039_6 if Z1004=="NZL_2002"
***missings
sum B3038_E if Z1004=="NZL_2002"
replace A2039_6_b = B5018_E-B3038_E if Z1004=="NZL_2002"
replace A2039_6_b= B5018_E-(2.65+2.34) if B3038_E==. & Z1004=="NZL_2002"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="NZL_2002"
*tab  A2039_6_b if Z1004=="NZL_2002"

**Party G
replace A2039_7 = B5018_G-B3038_G if Z1004=="NZL_2002"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="NZL_2002"
*tab  A2039_7 if Z1004=="NZL_2002"
***missings
sum B3038_G if Z1004=="NZL_2002"
replace A2039_7_b = B5018_G-B3038_G if Z1004=="NZL_2002"
replace A2039_7_b= B5018_G-(3.1+2.32) if B3038_G==. & Z1004=="NZL_2002"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="NZL_2002"
*tab  A2039_7_b if Z1004=="NZL_2002"

**Party H
replace A2039_8 = B5018_H-B3038_H if Z1004=="NZL_2002"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="NZL_2002"
*tab  A2039_8 if Z1004=="NZL_2002"
***missings
sum B3038_H if Z1004=="NZL_2002"
replace A2039_8_b = B5018_H-B3038_H if Z1004=="NZL_2002"
replace A2039_8_b= B5018_H-(2.82+2.2) if B3038_H==. & Z1004=="NZL_2002"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="NZL_2002"
*tab  A2039_8_b if Z1004=="NZL_2002"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7+A2039_8)/8 if Z1004=="NZL_2002"
sum  A2039 if Z1004=="NZL_2002"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b+A2039_8_b)/8 if Z1004=="NZL_2002"
sum  A2039_B if Z1004=="NZL_2002"
****************************************************************************************
***NLD_2002
sum B5018_A B5018_B B5018_C B5018_D B5018_E B5018_F B5018_G B5018_H if Z1004=="NOR_2001"


*tab B3038_A if Z1004=="NOR_2001"
*tab B3038_B if Z1004=="NOR_2001"
*tab B3038_C if Z1004=="NOR_2001"
*tab B3038_D if Z1004=="NOR_2001"

sum B3038_A B3038_B B3038_C B3038_D B3038_E B3038_F B3038_G B3038_H if Z1004=="NOR_2001"

mvdecode B3038_A, mv(97, 98, 99), if Z1004=="NOR_2001"
mvdecode B3038_B, mv(97, 98, 99), if Z1004=="NOR_2001"
mvdecode B3038_C, mv(97, 98, 99), if Z1004=="NOR_2001"
mvdecode B3038_D, mv(97, 98, 99), if Z1004=="NOR_2001"
mvdecode B3038_E, mv(97, 98, 99), if Z1004=="NOR_2001"
mvdecode B3038_F, mv(97, 98, 99), if Z1004=="NOR_2001"
mvdecode B3038_G, mv(97, 98, 99), if Z1004=="NOR_2001"
mvdecode B3038_H, mv(97, 98, 99), if Z1004=="NOR_2001"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*6 parties 
*  DAFEBC
replace A2037_1 =1 if B3038_D< B3038_A & Z1004=="NOR_2001"
replace A2037_1 =0 if B3038_D> B3038_A & Z1004=="NOR_2001"
replace A2037_1 =0 if B3038_D == B3038_A & Z1004=="NOR_2001"
replace A2037_1 =0 if B3038_D ==. & Z1004=="NOR_2001"
replace A2037_1 =0 if B3038_A ==. & Z1004=="NOR_2001"
*list A2037_1 B3038_C B3038_D if Z1004=="NOR_2001"
*tab A2037_1 if Z1004=="NOR_2001", miss

replace A2037_2 =1 if B3038_A< B3038_F & Z1004=="NOR_2001"
replace A2037_2 =0 if B3038_A> B3038_F & Z1004=="NOR_2001"
replace A2037_2 =0 if B3038_A == B3038_F & Z1004=="NOR_2001"
replace A2037_2 =0 if B3038_A ==. & Z1004=="NOR_2001"
replace A2037_2 =0 if B3038_F ==. & Z1004=="NOR_2001"
*list A2037_2 B3038_E B3038_G if Z1004=="NOR_2001"
*tab A2037_2 if Z1004=="NOR_2001"

replace A2037_3 =1 if B3038_F< B3038_E & Z1004=="NOR_2001"
replace A2037_3 =0 if B3038_F> B3038_E & Z1004=="NOR_2001"
replace A2037_3 =0 if B3038_F == B3038_E & Z1004=="NOR_2001"
replace A2037_3 =0 if B3038_F ==. & Z1004=="NOR_2001"
replace A2037_3 =0 if B3038_E ==. & Z1004=="NOR_2001"
*list A2037_3 B3038_A B3038_B if Z1004=="NOR_2001"
*tab A2037_3 if Z1004=="NOR_2001"

replace A2037_4 =1 if B3038_E< B3038_B & Z1004=="NOR_2001"
replace A2037_4 =0 if B3038_E> B3038_B & Z1004=="NOR_2001"
replace A2037_4 =0 if B3038_E == B3038_B & Z1004=="NOR_2001" 
replace A2037_4 =0 if B3038_E ==. & Z1004=="NOR_2001"
replace A2037_4 =0 if B3038_B ==. & Z1004=="NOR_2001"
*list A2037_4 B3038_B B3038_C if Z1004=="NOR_2001" 
*tab A2037_4 if Z1004=="NOR_2001"

replace A2037_5 =1 if B3038_B< B3038_C & Z1004=="NOR_2001"
replace A2037_5 =0 if B3038_B> B3038_C & Z1004=="NOR_2001"
replace A2037_5 =0 if B3038_B == B3038_C & Z1004=="NOR_2001"
replace A2037_5 =0 if B3038_B ==. & Z1004=="NOR_2001"
replace A2037_5 =0 if B3038_C ==. & Z1004=="NOR_2001"
*list A2037_5 B3038_C B3038_D if Z1004=="NOR_2001"
*tab A2037_5 if Z1004=="NOR_2001", missing

replace A2037_6 =1 if B3038_D< B3038_C & Z1004=="NOR_2001"
replace A2037_6 =0 if B3038_D> B3038_C & Z1004=="NOR_2001"
replace A2037_6 =0 if B3038_D == B3038_C & Z1004=="NOR_2001"
replace A2037_6 =0 if B3038_D ==. & Z1004=="NOR_2001"
replace A2037_6 =0 if B3038_C ==. & Z1004=="NOR_2001"
*list A2037_6 B3038_C B3038_D if Z1004=="NOR_2001"
*tab A2037_6 if Z1004=="NOR_2001", missing


***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="NOR_2001"
*tab A2037  if Z1004=="NOR_2001"

*)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =0 if B3038_A>5 & Z1004=="NOR_2001"
replace A2038_1 =0 if B3038_A==5 & Z1004=="NOR_2001"
replace A2038_1 =1 if B3038_A<5  & Z1004=="NOR_2001"
replace A2038_1 =0 if B3038_A==.  & Z1004=="NOR_2001"
*tab A2038_1 if Z1004=="NOR_2001"

replace A2038_2 =1 if B3038_B>5 & Z1004=="NOR_2001"
replace A2038_2 =0 if B3038_B==5 & Z1004=="NOR_2001"
replace A2038_2 =0 if B3038_B<5  & Z1004=="NOR_2001"
replace A2038_2 =0 if B3038_B==.  & Z1004=="NOR_2001"
*list A2038_2 B3038_B if Z1004=="NOR_2001"
*tab A2038_2 if Z1004=="NOR_2001"

replace A2038_3 =0 if B3038_C<5 & Z1004=="NOR_2001"
replace A2038_3 =0 if B3038_C==5 & Z1004=="NOR_2001"
replace A2038_3 =1 if B3038_C>5  & Z1004=="NOR_2001"
replace A2038_3 =0 if B3038_C==.  & Z1004=="NOR_2001"
*tab A2038_3 if Z1004=="NOR_2001"
*list B3038_C A2038_3 if Z1004=="NOR_2001"

replace A2038_4 =1 if B3038_D<5 & Z1004=="NOR_2001"
replace A2038_4 =0 if B3038_D==5 & Z1004=="NOR_2001"
replace A2038_4 =0 if B3038_D>5  & Z1004=="NOR_2001"
replace A2038_4 =0 if B3038_D==.  & Z1004=="NOR_2001"
*list B3038_D A2038_4 if Z1004=="NOR_2001"
*tab A2038_4 if Z1004=="NOR_2001"

replace A2038_5 =0 if B3038_E<5 & Z1004=="NOR_2001"
replace A2038_5 =1 if B3038_E==5 & Z1004=="NOR_2001"
replace A2038_5 =0 if B3038_E>5  & Z1004=="NOR_2001"
replace A2038_5 =0 if B3038_E==.  & Z1004=="NOR_2001"
*list B3038_F A2038_5 if Z1004=="NOR_2001"
*tab A2038_5 if Z1004=="NOR_2001"

replace A2038_6 =1 if B3038_F<5 & Z1004=="NOR_2001"
replace A2038_6 =0 if B3038_F==5 & Z1004=="NOR_2001"
replace A2038_6 =0 if B3038_F>5  & Z1004=="NOR_2001"
replace A2038_6 =0 if B3038_F==.  & Z1004=="NOR_2001"
*list B3038_F A2038_6 if Z1004=="NOR_2001"
*tab A2038_6 if Z1004=="NOR_2001"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="NOR_2001"
*tab A2038 if Z1004=="NOR_2001"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="NOR_2001"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="NOR_2001"
*tab  A2039_1 if Z1004=="NOR_2001"
***missings
sum B3038_A if Z1004=="NOR_2001"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="NOR_2001"
replace A2039_1_b= B5018_A-(4.6+1.78) if B3038_A==. & Z1004=="NOR_2001"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="NOR_2001"
*tab  A2039_1_b if Z1004=="NOR_2001"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="NOR_2001"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="NOR_2001"
*tab  A2039_2 if Z1004=="NOR_2001"
***missings
sum B3038_B if Z1004=="NOR_2001"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="NOR_2001"
replace A2039_2_b= B5018_B-(8+1.54) if B3038_B==. & Z1004=="NOR_2001"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="NOR_2001"
*tab  A2039_2_b if Z1004=="NOR_2001"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="NOR_2001"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="NOR_2001"
*tab  A2039_3 if Z1004=="NOR_2001"
***missings
sum B3038_C if Z1004=="NOR_2001"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="NOR_2001"
replace A2039_3_b= B5018_C-(8.1+2.1) if B3038_C==. & Z1004=="NOR_2001"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="NOR_2001"
*tab  A2039_3_b if Z1004=="NOR_2001"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="NOR_2001"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="NOR_2001"
*tab  A2039_4 if Z1004=="NOR_2001"
***missings
sum B3038_D if Z1004=="NOR_2001"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="NOR_2001"
replace A2039_4_b= B5018_D-(2.77+1.58) if B3038_D==. & Z1004=="NOR_2001"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="NOR_2001"
*tab  A2039_4_b if Z1004=="NOR_2001"

**Party F
replace A2039_5 = B5018_F-B3038_F if Z1004=="NOR_2001"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="NOR_2001"
*tab  A2039_5 if Z1004=="NOR_2001"
***missings
sum B3038_F if Z1004=="NOR_2001"
replace A2039_5_b = B5018_F-B3038_F if Z1004=="NOR_2001"
replace A2039_5_b= B5018_F-(4.46+1.46) if B3038_F==. & Z1004=="NOR_2001"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="NOR_2001"
*tab  A2039_5_b if Z1004=="NOR_2001"

**Party E
replace A2039_6 = B5018_E-B3038_E if Z1004=="NOR_2001"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="NOR_2001"
*tab  A2039_6 if Z1004=="NOR_2001"
***missings
sum B3038_E if Z1004=="NOR_2001"
replace A2039_6_b = B5018_E-B3038_E if Z1004=="NOR_2001"
replace A2039_6_b= B5018_E-(5.9+1.5) if B3038_E==. & Z1004=="NOR_2001"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="NOR_2001"
*tab  A2039_6_b if Z1004=="NOR_2001"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6)/6 if Z1004=="NOR_2001"
sum  A2039 if Z1004=="NOR_2001"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b)/6 if Z1004=="NOR_2001"
sum  A2039_B if Z1004=="NOR_2001"


****************************************************************************************
**POL_2001
sum B5018_A B5018_B B5018_C B5018_D B5018_E B5018_F B5018_G B5018_H if Z1004=="POL_2001"


*tab B3038_A if Z1004=="POL_2001"
*tab B3038_B if Z1004=="POL_2001"
*tab B3038_C if Z1004=="POL_2001"
*tab B3038_D if Z1004=="POL_2001"

sum B3038_A B3038_B B3038_C B3038_D B3038_E B3038_F B3038_G B3038_H if Z1004=="POL_2001"

mvdecode B3038_A, mv(96, 97, 98, 99), if Z1004=="POL_2001"
mvdecode B3038_B, mv(96, 97, 98, 99), if Z1004=="POL_2001"
mvdecode B3038_C, mv(96, 97, 98, 99), if Z1004=="POL_2001"
mvdecode B3038_D, mv(96, 97, 98, 99), if Z1004=="POL_2001"
mvdecode B3038_E, mv(96, 97, 98, 99), if Z1004=="POL_2001"
mvdecode B3038_F, mv(96, 97, 98, 99), if Z1004=="POL_2001"
mvdecode B3038_G, mv(96, 97, 98, 99), if Z1004=="POL_2001"
mvdecode B3038_H, mv(96, 97, 98, 99), if Z1004=="POL_2001"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*8 parties 
*  CAEHDBFH
replace A2037_1 =1 if B3038_C< B3038_A & Z1004=="POL_2001"
replace A2037_1 =0 if B3038_C> B3038_A & Z1004=="POL_2001"
replace A2037_1 =0 if B3038_C == B3038_A & Z1004=="POL_2001"
replace A2037_1 =0 if B3038_C ==. & Z1004=="POL_2001"
replace A2037_1 =0 if B3038_A ==. & Z1004=="POL_2001"
*list A2037_1 B3038_C B3038_A if Z1004=="POL_2001"
*tab A2037_1 if Z1004=="POL_2001", miss

replace A2037_2 =1 if B3038_A< B3038_E & Z1004=="POL_2001"
replace A2037_2 =0 if B3038_A> B3038_E & Z1004=="POL_2001"
replace A2037_2 =0 if B3038_A == B3038_E & Z1004=="POL_2001"
replace A2037_2 =0 if B3038_A ==. & Z1004=="POL_2001"
replace A2037_2 =0 if B3038_E ==. & Z1004=="POL_2001"
*list A2037_2 B3038_E B3038_G if Z1004=="POL_2001"
*tab A2037_2 if Z1004=="POL_2001"

replace A2037_3 =1 if B3038_E< B3038_H & Z1004=="POL_2001"
replace A2037_3 =0 if B3038_E> B3038_H & Z1004=="POL_2001"
replace A2037_3 =0 if B3038_E == B3038_H & Z1004=="POL_2001"
replace A2037_3 =0 if B3038_E ==. & Z1004=="POL_2001"
replace A2037_3 =0 if B3038_H ==. & Z1004=="POL_2001"
*list A2037_3 B3038_A B3038_B if Z1004=="POL_2001"
*tab A2037_3 if Z1004=="POL_2001"

replace A2037_4 =1 if B3038_H< B3038_D & Z1004=="POL_2001"
replace A2037_4 =0 if B3038_H> B3038_D & Z1004=="POL_2001"
replace A2037_4 =0 if B3038_H == B3038_D & Z1004=="POL_2001" 
replace A2037_4 =0 if B3038_H ==. & Z1004=="POL_2001"
replace A2037_4 =0 if B3038_D ==. & Z1004=="POL_2001"
*list A2037_4 B3038_B B3038_C if Z1004=="POL_2001" 
*tab A2037_4 if Z1004=="POL_2001"

replace A2037_5 =1 if B3038_D< B3038_B & Z1004=="POL_2001"
replace A2037_5 =0 if B3038_D> B3038_B & Z1004=="POL_2001"
replace A2037_5 =0 if B3038_D == B3038_B & Z1004=="POL_2001"
replace A2037_5 =0 if B3038_D ==. & Z1004=="POL_2001"
replace A2037_5 =0 if B3038_B ==. & Z1004=="POL_2001"
*list A2037_5 B3038_C B3038_D if Z1004=="POL_2001"
*tab A2037_5 if Z1004=="POL_2001", missing

replace A2037_6 =1 if B3038_B< B3038_G & Z1004=="POL_2001"
replace A2037_6 =0 if B3038_B> B3038_G & Z1004=="POL_2001"
replace A2037_6 =0 if B3038_B == B3038_G & Z1004=="POL_2001"
replace A2037_6 =0 if B3038_B ==. & Z1004=="POL_2001"
replace A2037_6 =0 if B3038_G ==. & Z1004=="POL_2001"
*list A2037_6 B3038_C B3038_D if Z1004=="POL_2001"
*tab A2037_6 if Z1004=="POL_2001", missing

replace A2037_7 =0 if B3038_F< B3038_G & Z1004=="POL_2001"
replace A2037_7 =0 if B3038_F> B3038_G & Z1004=="POL_2001"
replace A2037_7 =1 if B3038_F == B3038_G & Z1004=="POL_2001"
replace A2037_7 =0 if B3038_F ==. & Z1004=="POL_2001"
replace A2037_7 =0 if B3038_G ==. & Z1004=="POL_2001"
*list A2037_7 B3038_C B3038_D if Z1004=="POL_2001"
*tab A2037_7 if Z1004=="POL_2001", missing

replace A2037_8 =1 if B3038_C< B3038_G & Z1004=="POL_2001"
replace A2037_8 =0 if B3038_C> B3038_G & Z1004=="POL_2001"
replace A2037_8 =0 if B3038_C == B3038_G & Z1004=="POL_2001"
replace A2037_8 =0 if B3038_C ==. & Z1004=="POL_2001"
replace A2037_8 =0 if B3038_G ==. & Z1004=="POL_2001"
*list A2037_8 B3038_C B3038_D if Z1004=="POL_2001"
*tab A2037_8 if Z1004=="POL_2001", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7+A2037_8)/8 if Z1004=="POL_2001"
*tab A2037  if Z1004=="POL_2001"

*)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =0 if B3038_A>5 & Z1004=="POL_2001"
replace A2038_1 =0 if B3038_A==5 & Z1004=="POL_2001"
replace A2038_1 =1 if B3038_A<5  & Z1004=="POL_2001"
replace A2038_1 =0 if B3038_A==.  & Z1004=="POL_2001"
*tab A2038_1 if Z1004=="POL_2001"

replace A2038_2 =1 if B3038_B>5 & Z1004=="POL_2001"
replace A2038_2 =0 if B3038_B==5 & Z1004=="POL_2001"
replace A2038_2 =0 if B3038_B<5  & Z1004=="POL_2001"
replace A2038_2 =0 if B3038_B==.  & Z1004=="POL_2001"
*list A2038_2 B3038_B if Z1004=="POL_2001"
*tab A2038_2 if Z1004=="POL_2001"

replace A2038_3 =1 if B3038_C<5 & Z1004=="POL_2001"
replace A2038_3 =0 if B3038_C==5 & Z1004=="POL_2001"
replace A2038_3 =0 if B3038_C>5  & Z1004=="POL_2001"
replace A2038_3 =0 if B3038_C==.  & Z1004=="POL_2001"
*tab A2038_3 if Z1004=="POL_2001"
*list B3038_C A2038_3 if Z1004=="POL_2001"

replace A2038_4 =0 if B3038_D<5 & Z1004=="POL_2001"
replace A2038_4 =0 if B3038_D==5 & Z1004=="POL_2001"
replace A2038_4 =1 if B3038_D>5  & Z1004=="POL_2001"
replace A2038_4 =0 if B3038_D==.  & Z1004=="POL_2001"
*list B3038_D A2038_4 if Z1004=="POL_2001"
*tab A2038_4 if Z1004=="POL_2001"

replace A2038_5 =0 if B3038_E<5 & Z1004=="POL_2001"
replace A2038_5 =1 if B3038_E==5 & Z1004=="POL_2001"
replace A2038_5 =0 if B3038_E>5  & Z1004=="POL_2001"
replace A2038_5 =0 if B3038_E==.  & Z1004=="POL_2001"
*list B3038_F A2038_5 if Z1004=="POL_2001"
*tab A2038_5 if Z1004=="POL_2001"

replace A2038_6 =0 if B3038_F<5 & Z1004=="POL_2001"
replace A2038_6 =0 if B3038_F==5 & Z1004=="POL_2001"
replace A2038_6 =1 if B3038_F>5  & Z1004=="POL_2001"
replace A2038_6 =0 if B3038_F==.  & Z1004=="POL_2001"
*list B3038_F A2038_6 if Z1004=="POL_2001"
*tab A2038_6 if Z1004=="POL_2001"

replace A2038_7 =0 if B3038_G<5 & Z1004=="POL_2001"
replace A2038_7 =0 if B3038_G==5 & Z1004=="POL_2001"
replace A2038_7 =1 if B3038_G>5  & Z1004=="POL_2001"
replace A2038_7 =0 if B3038_G==.  & Z1004=="POL_2001"
*list B3038_G A2038_7 if Z1004=="POL_2001"
*tab A2038_7 if Z1004=="POL_2001"

replace A2038_8 =0 if B3038_H<5 & Z1004=="POL_2001"
replace A2038_8 =0 if B3038_H==5 & Z1004=="POL_2001"
replace A2038_8 =1 if B3038_H>5  & Z1004=="POL_2001"
replace A2038_8 =0 if B3038_H==.  & Z1004=="POL_2001"
*list B3038_H A2038_8 if Z1004=="POL_2001"
*tab A2038_8 if Z1004=="POL_2001"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7+A2038_8)/8 if Z1004=="POL_2001"
*tab A2038 if Z1004=="POL_2001"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="POL_2001"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="POL_2001"
*tab  A2039_1 if Z1004=="POL_2001"
***missings
sum B3038_A if Z1004=="POL_2001"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="POL_2001"
replace A2039_1_b= B5018_A-(1.32+2.12) if B3038_A==. & Z1004=="POL_2001"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="POL_2001"
*tab  A2039_1_b if Z1004=="POL_2001"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="POL_2001"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="POL_2001"
*tab  A2039_2 if Z1004=="POL_2001"
***missings
sum B3038_B if Z1004=="POL_2001"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="POL_2001"
replace A2039_2_b= B5018_B-(6.34+2.38) if B3038_B==. & Z1004=="POL_2001"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="POL_2001"
*tab  A2039_2_b if Z1004=="POL_2001"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="POL_2001"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="POL_2001"
*tab  A2039_3 if Z1004=="POL_2001"
***missings
sum B3038_C if Z1004=="POL_2001"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="POL_2001"
replace A2039_3_b= B5018_C-(4.63+2.46) if B3038_C==. & Z1004=="POL_2001"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="POL_2001"
*tab  A2039_3_b if Z1004=="POL_2001"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="POL_2001"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="POL_2001"
*tab  A2039_4 if Z1004=="POL_2001"
***missings
sum B3038_D if Z1004=="POL_2001"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="POL_2001"
replace A2039_4_b= B5018_D-(6.65+2.24) if B3038_D==. & Z1004=="POL_2001"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="POL_2001"
*tab  A2039_4_b if Z1004=="POL_2001"

**Party F
replace A2039_5 = B5018_F-B3038_F if Z1004=="POL_2001"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="POL_2001"
*tab  A2039_5 if Z1004=="POL_2001"
***missings
sum B3038_F if Z1004=="POL_2001"
replace A2039_5_b = B5018_F-B3038_F if Z1004=="POL_2001"
replace A2039_5_b= B5018_F-(7.21+2.77) if B3038_F==. & Z1004=="POL_2001"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="POL_2001"
*tab  A2039_5_b if Z1004=="POL_2001"

**Party E
replace A2039_6 = B5018_E-B3038_E if Z1004=="POL_2001"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="POL_2001"
*tab  A2039_6 if Z1004=="POL_2001"
***missings
sum B3038_E if Z1004=="POL_2001"
replace A2039_6_b = B5018_E-B3038_E if Z1004=="POL_2001"
replace A2039_6_b= B5018_E-(4.31+2.17) if B3038_E==. & Z1004=="POL_2001"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="POL_2001"
*tab  A2039_6_b if Z1004=="POL_2001"

**Party G
replace A2039_7 = B5018_G-B3038_G if Z1004=="POL_2001"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="POL_2001"
*tab  A2039_7 if Z1004=="POL_2001"
***missings
sum B3038_G if Z1004=="POL_2001"
replace A2039_7_b = B5018_G-B3038_G if Z1004=="POL_2001"
replace A2039_7_b= B5018_G-(8.07+2.62) if B3038_G==. & Z1004=="POL_2001"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="POL_2001"
*tab  A2039_7_b if Z1004=="POL_2001"

**Party H
replace A2039_8 = B5018_H-B3038_H if Z1004=="POL_2001"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="POL_2001"
*tab  A2039_8 if Z1004=="POL_2001"
***missings
sum B3038_H if Z1004=="POL_2001"
replace A2039_8_b = B5018_H-B3038_H if Z1004=="POL_2001"
replace A2039_8_b= B5018_H-(6.12+2.57) if B3038_H==. & Z1004=="POL_2001"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="POL_2001"
*tab  A2039_8_b if Z1004=="POL_2001"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7+A2039_8)/8 if Z1004=="POL_2001"
sum  A2039 if Z1004=="POL_2001"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b+A2039_8_b)/8 if Z1004=="POL_2001"
sum  A2039_B if Z1004=="POL_2001"

****************************************************************************************
**PRT_2005
sum B5018_A B5018_B B5018_C B5018_D B5018_E B5018_F B5018_G B5018_H if Z1004=="PRT_2005"


*tab B3038_A if Z1004=="PRT_2005"
*tab B3038_B if Z1004=="PRT_2005"
*tab B3038_C if Z1004=="PRT_2005"
*tab B3038_D if Z1004=="PRT_2005", miss

sum B3038_A B3038_B B3038_C B3038_D B3038_E B3038_F B3038_G B3038_H if Z1004=="PRT_2005"

mvdecode B3038_A, mv(96, 97, 98, 99), if Z1004=="PRT_2005"
mvdecode B3038_B, mv(96, 97, 98, 99), if Z1004=="PRT_2005"
mvdecode B3038_C, mv(96, 97, 98, 99), if Z1004=="PRT_2005"
mvdecode B3038_D, mv(96, 97, 98, 99), if Z1004=="PRT_2005"
mvdecode B3038_E, mv(96, 97, 98, 99), if Z1004=="PRT_2005"
mvdecode B3038_F, mv(96, 97, 98, 99), if Z1004=="PRT_2005"
mvdecode B3038_G, mv(96, 97, 98, 99), if Z1004=="PRT_2005"
mvdecode B3038_H, mv(96, 97, 98, 99), if Z1004=="PRT_2005"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*5 parties 
*  ECABD
replace A2037_1 =0 if B3038_C< B3038_E & Z1004=="PRT_2005"
replace A2037_1 =0 if B3038_C> B3038_E & Z1004=="PRT_2005"
replace A2037_1 =1 if B3038_C == B3038_E & Z1004=="PRT_2005"
replace A2037_1 =0 if B3038_C ==. & Z1004=="PRT_2005"
replace A2037_1 =0 if B3038_E ==. & Z1004=="PRT_2005"
*list A2037_1 B3038_C B3038_A if Z1004=="PRT_2005"
*tab A2037_1 if Z1004=="PRT_2005", miss

replace A2037_2 =1 if B3038_C< B3038_A & Z1004=="PRT_2005"
replace A2037_2 =0 if B3038_C> B3038_A & Z1004=="PRT_2005"
replace A2037_2 =0 if B3038_C == B3038_A & Z1004=="PRT_2005"
replace A2037_2 =0 if B3038_C ==. & Z1004=="PRT_2005"
replace A2037_2 =0 if B3038_A ==. & Z1004=="PRT_2005"
*list A2037_2 B3038_E B3038_G if Z1004=="PRT_2005"
*tab A2037_2 if Z1004=="PRT_2005"

replace A2037_3 =1 if B3038_A< B3038_B & Z1004=="PRT_2005"
replace A2037_3 =0 if B3038_A> B3038_B & Z1004=="PRT_2005"
replace A2037_3 =0 if B3038_A == B3038_B & Z1004=="PRT_2005"
replace A2037_3 =0 if B3038_A ==. & Z1004=="PRT_2005"
replace A2037_3 =0 if B3038_B ==. & Z1004=="PRT_2005"
*list A2037_3 B3038_A B3038_B if Z1004=="PRT_2005"
*tab A2037_3 if Z1004=="PRT_2005"

replace A2037_4 =1 if B3038_B< B3038_D & Z1004=="PRT_2005"
replace A2037_4 =0 if B3038_B> B3038_D & Z1004=="PRT_2005"
replace A2037_4 =0 if B3038_B == B3038_D & Z1004=="PRT_2005" 
replace A2037_4 =0 if B3038_B ==. & Z1004=="PRT_2005"
replace A2037_4 =0 if B3038_D ==. & Z1004=="PRT_2005"
*list A2037_4 B3038_B B3038_C if Z1004=="PRT_2005" 
*tab A2037_4 if Z1004=="PRT_2005"

replace A2037_5 =1 if B3038_E< B3038_D & Z1004=="PRT_2005"
replace A2037_5 =0 if B3038_E> B3038_D & Z1004=="PRT_2005"
replace A2037_5 =0 if B3038_E == B3038_D & Z1004=="PRT_2005"
replace A2037_5 =0 if B3038_E ==. & Z1004=="PRT_2005"
replace A2037_5 =0 if B3038_E ==. & Z1004=="PRT_2005"
*list A2037_5 B3038_C B3038_D if Z1004=="PRT_2005"
*tab A2037_5 if Z1004=="PRT_2005", missing


***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="PRT_2005"
*tab A2037  if Z1004=="PRT_2005"

*)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =0 if B3038_A>5 & Z1004=="PRT_2005"
replace A2038_1 =1 if B3038_A==5 & Z1004=="PRT_2005"
replace A2038_1 =0 if B3038_A<5  & Z1004=="PRT_2005"
replace A2038_1 =0 if B3038_A==.  & Z1004=="PRT_2005"
*tab A2038_1 if Z1004=="PRT_2005"

replace A2038_2 =1 if B3038_B>5 & Z1004=="PRT_2005"
replace A2038_2 =0 if B3038_B==5 & Z1004=="PRT_2005"
replace A2038_2 =0 if B3038_B<5  & Z1004=="PRT_2005"
replace A2038_2 =0 if B3038_B==.  & Z1004=="PRT_2005"
*list A2038_2 B3038_B if Z1004=="PRT_2005"
*tab A2038_2 if Z1004=="PRT_2005"

replace A2038_3 =1 if B3038_C<5 & Z1004=="PRT_2005"
replace A2038_3 =0 if B3038_C==5 & Z1004=="PRT_2005"
replace A2038_3 =0 if B3038_C>5  & Z1004=="PRT_2005"
replace A2038_3 =0 if B3038_C==.  & Z1004=="PRT_2005"
*tab A2038_3 if Z1004=="PRT_2005"
*list B3038_C A2038_3 if Z1004=="PRT_2005"

replace A2038_4 =0 if B3038_D<5 & Z1004=="PRT_2005"
replace A2038_4 =0 if B3038_D==5 & Z1004=="PRT_2005"
replace A2038_4 =1 if B3038_D>5  & Z1004=="PRT_2005"
replace A2038_4 =0 if B3038_D==.  & Z1004=="PRT_2005"
*list B3038_D A2038_4 if Z1004=="PRT_2005"
*tab A2038_4 if Z1004=="PRT_2005"

replace A2038_5 =1 if B3038_E<5 & Z1004=="PRT_2005"
replace A2038_5 =0 if B3038_E==5 & Z1004=="PRT_2005"
replace A2038_5 =0 if B3038_E>5  & Z1004=="PRT_2005"
replace A2038_5 =0 if B3038_E==.  & Z1004=="PRT_2005"
*list B3038_F A2038_5 if Z1004=="PRT_2005"
*tab A2038_5 if Z1004=="PRT_2005"



*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="PRT_2005"
*tab A2038 if Z1004=="PRT_2005"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="PRT_2005"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="PRT_2005"
*tab  A2039_1 if Z1004=="PRT_2005"
***missings
sum B3038_A if Z1004=="PRT_2005"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="PRT_2005"
replace A2039_1_b= B5018_A-(4.68+2.28) if B3038_A==. & Z1004=="PRT_2005"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="PRT_2005"
*tab  A2039_1_b if Z1004=="PRT_2005"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="PRT_2005"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="PRT_2005"
*tab  A2039_2 if Z1004=="PRT_2005"
***missings
sum B3038_B if Z1004=="PRT_2005"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="PRT_2005"
replace A2039_2_b= B5018_B-(6.93+2.33) if B3038_B==. & Z1004=="PRT_2005"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="PRT_2005"
*tab  A2039_2_b if Z1004=="PRT_2005"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="PRT_2005"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="PRT_2005"
*tab  A2039_3 if Z1004=="PRT_2005"
***missings
sum B3038_C if Z1004=="PRT_2005"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="PRT_2005"
replace A2039_3_b= B5018_C-(2.14+2.08) if B3038_C==. & Z1004=="PRT_2005"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="PRT_2005"
*tab  A2039_3_b if Z1004=="PRT_2005"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="PRT_2005"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="PRT_2005"
*tab  A2039_4 if Z1004=="PRT_2005"
***missings
sum B3038_D if Z1004=="PRT_2005"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="PRT_2005"
replace A2039_4_b= B5018_D-(7.33+2.86) if B3038_D==. & Z1004=="PRT_2005"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="PRT_2005"
*tab  A2039_4_b if Z1004=="PRT_2005"



**Party E
replace A2039_6 = B5018_E-B3038_E if Z1004=="PRT_2005"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="PRT_2005"
*tab  A2039_6 if Z1004=="PRT_2005"
***missings
sum B3038_E if Z1004=="PRT_2005"
replace A2039_6_b = B5018_E-B3038_E if Z1004=="PRT_2005"
replace A2039_6_b= B5018_E-(1.67+2.06) if B3038_E==. & Z1004=="PRT_2005"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="PRT_2005"
*tab  A2039_6_b if Z1004=="PRT_2005"


**Party H
replace A2039_8 = B5018_H-B3038_H if Z1004=="PRT_2005"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="PRT_2005"
*tab  A2039_8 if Z1004=="PRT_2005"
***missings
sum B3038_H if Z1004=="PRT_2005"
replace A2039_8_b = B5018_H-B3038_H if Z1004=="PRT_2005"
replace A2039_8_b= B5018_H-(6.12+2.57) if B3038_H==. & Z1004=="PRT_2005"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="PRT_2005"
*tab  A2039_8_b if Z1004=="PRT_2005"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_6)/5 if Z1004=="PRT_2005"
sum  A2039 if Z1004=="PRT_2005"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_6_b)/5 if Z1004=="PRT_2005"
sum  A2039_B if Z1004=="PRT_2005"


****************************************************************************************
***ROU_2004
sum B5018_A B5018_B B5018_C B5018_D B5018_E B5018_F B5018_G B5018_H if Z1004=="ROU_2004"

*tab B3038_A if Z1004=="ROU_2004"
*tab B3038_B if Z1004=="ROU_2004"
*tab B3038_C if Z1004=="ROU_2004"
*tab B3038_D if Z1004=="ROU_2004", miss

sum B3038_A B3038_B B3038_C B3038_D B3038_E B3038_F B3038_G B3038_H if Z1004=="ROU_2004"

mvdecode B3038_A, mv(96, 97, 98, 99), if Z1004=="ROU_2004"
mvdecode B3038_B, mv(96, 97, 98, 99), if Z1004=="ROU_2004"
mvdecode B3038_C, mv(96, 97, 98, 99), if Z1004=="ROU_2004"
mvdecode B3038_D, mv(96, 97, 98, 99), if Z1004=="ROU_2004"
mvdecode B3038_E, mv(96, 97, 98, 99), if Z1004=="ROU_2004"
mvdecode B3038_F, mv(96, 97, 98, 99), if Z1004=="ROU_2004"
mvdecode B3038_G, mv(96, 97, 98, 99), if Z1004=="ROU_2004"
mvdecode B3038_H, mv(96, 97, 98, 99), if Z1004=="ROU_2004"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*6 parties 
*  dfachb
replace A2037_1 =0 if B3038_D< B3038_F & Z1004=="ROU_2004"
replace A2037_1 =0 if B3038_D> B3038_F & Z1004=="ROU_2004"
replace A2037_1 =1 if B3038_D == B3038_F & Z1004=="ROU_2004"
replace A2037_1 =0 if B3038_D ==. & Z1004=="ROU_2004"
replace A2037_1 =0 if B3038_F ==. & Z1004=="ROU_2004"
*list A2037_1 B3038_C B3038_A if Z1004=="ROU_2004"
*tab A2037_1 if Z1004=="ROU_2004", miss

replace A2037_2 =1 if B3038_F< B3038_A & Z1004=="ROU_2004"
replace A2037_2 =0 if B3038_F> B3038_A & Z1004=="ROU_2004"
replace A2037_2 =0 if B3038_F == B3038_A & Z1004=="ROU_2004"
replace A2037_2 =0 if B3038_F ==. & Z1004=="ROU_2004"
replace A2037_2 =0 if B3038_A ==. & Z1004=="ROU_2004"
*list A2037_2 B3038_E B3038_G if Z1004=="ROU_2004"
*tab A2037_2 if Z1004=="ROU_2004"

replace A2037_3 =0 if B3038_A< B3038_C & Z1004=="ROU_2004"
replace A2037_3 =0 if B3038_A> B3038_C & Z1004=="ROU_2004"
replace A2037_3 =1 if B3038_A == B3038_C & Z1004=="ROU_2004"
replace A2037_3 =0 if B3038_A ==. & Z1004=="ROU_2004"
replace A2037_3 =0 if B3038_C ==. & Z1004=="ROU_2004"
*list A2037_3 B3038_A B3038_B if Z1004=="ROU_2004"
*tab A2037_3 if Z1004=="ROU_2004"

replace A2037_4 =0 if B3038_C< B3038_H & Z1004=="ROU_2004"
replace A2037_4 =0 if B3038_C> B3038_H & Z1004=="ROU_2004"
replace A2037_4 =1 if B3038_C == B3038_H & Z1004=="ROU_2004" 
replace A2037_4 =0 if B3038_C ==. & Z1004=="ROU_2004"
replace A2037_4 =0 if B3038_H ==. & Z1004=="ROU_2004"
*list A2037_4 B3038_B B3038_C if Z1004=="ROU_2004" 
*tab A2037_4 if Z1004=="ROU_2004"

replace A2037_5 =1 if B3038_H< B3038_B & Z1004=="ROU_2004"
replace A2037_5 =0 if B3038_H> B3038_B & Z1004=="ROU_2004"
replace A2037_5 =0 if B3038_H == B3038_B & Z1004=="ROU_2004"
replace A2037_5 =0 if B3038_H ==. & Z1004=="ROU_2004"
replace A2037_5 =0 if B3038_B ==. & Z1004=="ROU_2004"
*list A2037_5 B3038_C B3038_D if Z1004=="ROU_2004"
*tab A2037_5 if Z1004=="ROU_2004", missing

replace A2037_6 =1 if B3038_D< B3038_B & Z1004=="ROU_2004"
replace A2037_6 =0 if B3038_D> B3038_B & Z1004=="ROU_2004"
replace A2037_6 =0 if B3038_D == B3038_B & Z1004=="ROU_2004"
replace A2037_6 =0 if B3038_D ==. & Z1004=="ROU_2004"
replace A2037_6 =0 if B3038_B ==. & Z1004=="ROU_2004"
*list A2037_6 B3038_C B3038_D if Z1004=="ROU_2004"
*tab A2037_6 if Z1004=="ROU_2004", missing


***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="ROU_2004"
*tab A2037  if Z1004=="ROU_2004"

*)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =0 if B3038_A>5 & Z1004=="ROU_2004"
replace A2038_1 =1 if B3038_A==5 & Z1004=="ROU_2004"
replace A2038_1 =0 if B3038_A<5  & Z1004=="ROU_2004"
replace A2038_1 =0 if B3038_A==.  & Z1004=="ROU_2004"
*tab A2038_1 if Z1004=="ROU_2004"

replace A2038_2 =1 if B3038_B>5 & Z1004=="ROU_2004"
replace A2038_2 =0 if B3038_B==5 & Z1004=="ROU_2004"
replace A2038_2 =0 if B3038_B<5  & Z1004=="ROU_2004"
replace A2038_2 =0 if B3038_B==.  & Z1004=="ROU_2004"
*list A2038_2 B3038_B if Z1004=="ROU_2004"
*tab A2038_2 if Z1004=="ROU_2004"

replace A2038_3 =0 if B3038_C<5 & Z1004=="ROU_2004"
replace A2038_3 =1 if B3038_C==5 & Z1004=="ROU_2004"
replace A2038_3 =0 if B3038_C>5  & Z1004=="ROU_2004"
replace A2038_3 =0 if B3038_C==.  & Z1004=="ROU_2004"
*tab A2038_3 if Z1004=="ROU_2004"
*list B3038_C A2038_3 if Z1004=="ROU_2004"

replace A2038_4 =1 if B3038_D<5 & Z1004=="ROU_2004"
replace A2038_4 =0 if B3038_D==5 & Z1004=="ROU_2004"
replace A2038_4 =0 if B3038_D>5  & Z1004=="ROU_2004"
replace A2038_4 =0 if B3038_D==.  & Z1004=="ROU_2004"
*list B3038_D A2038_4 if Z1004=="ROU_2004"
*tab A2038_4 if Z1004=="ROU_2004"

replace A2038_6 =1 if B3038_F<5 & Z1004=="ROU_2004"
replace A2038_6 =0 if B3038_F==5 & Z1004=="ROU_2004"
replace A2038_6 =0 if B3038_F>5  & Z1004=="ROU_2004"
replace A2038_6 =0 if B3038_F==.  & Z1004=="ROU_2004"
*list B3038_F A2038_6 if Z1004=="ROU_2004"
*tab A2038_6 if Z1004=="ROU_2004"

replace A2038_8 =0 if B3038_H<5 & Z1004=="ROU_2004"
replace A2038_8 =1 if B3038_H==5 & Z1004=="ROU_2004"
replace A2038_8 =0 if B3038_H>5  & Z1004=="ROU_2004"
replace A2038_8 =0 if B3038_H==.  & Z1004=="ROU_2004"
*list B3038_H A2038_8 if Z1004=="ROU_2004"
*tab A2038_8 if Z1004=="ROU_2004"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_6+A2038_8)/6 if Z1004=="ROU_2004"
*tab A2038 if Z1004=="ROU_2004"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="ROU_2004"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="ROU_2004"
*tab  A2039_1 if Z1004=="ROU_2004"
***missings
sum B3038_A if Z1004=="ROU_2004"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="ROU_2004"
replace A2039_1_b= B5018_A-(4.14+3.18) if B3038_A==. & Z1004=="ROU_2004"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="ROU_2004"
*tab  A2039_1_b if Z1004=="ROU_2004"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="ROU_2004"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="ROU_2004"
*tab  A2039_2 if Z1004=="ROU_2004"
***missings
sum B3038_B if Z1004=="ROU_2004"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="ROU_2004"
replace A2039_2_b= B5018_B-(6.86+2.6) if B3038_B==. & Z1004=="ROU_2004"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="ROU_2004"
*tab  A2039_2_b if Z1004=="ROU_2004"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="ROU_2004"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="ROU_2004"
*tab  A2039_3 if Z1004=="ROU_2004"
***missings
sum B3038_C if Z1004=="ROU_2004"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="ROU_2004"
replace A2039_3_b= B5018_C-(6.77+2.63) if B3038_C==. & Z1004=="ROU_2004"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="ROU_2004"
*tab  A2039_3_b if Z1004=="ROU_2004"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="ROU_2004"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="ROU_2004"
*tab  A2039_4 if Z1004=="ROU_2004"
***missings
sum B3038_D if Z1004=="ROU_2004"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="ROU_2004"
replace A2039_4_b= B5018_D-(3.76+2.95) if B3038_D==. & Z1004=="ROU_2004"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="ROU_2004"
*tab  A2039_4_b if Z1004=="ROU_2004"

**Party F
replace A2039_5 = B5018_F-B3038_F if Z1004=="ROU_2004"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="ROU_2004"
*tab  A2039_5 if Z1004=="ROU_2004"
***missings
sum B3038_F if Z1004=="ROU_2004"
replace A2039_5_b = B5018_F-B3038_F if Z1004=="ROU_2004"
replace A2039_5_b= B5018_F-(4.67+2.85) if B3038_F==. & Z1004=="ROU_2004"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="ROU_2004"
*tab  A2039_5_b if Z1004=="ROU_2004"


**Party H
replace A2039_8 = B5018_H-B3038_H if Z1004=="ROU_2004"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="ROU_2004"
*tab  A2039_8 if Z1004=="ROU_2004"
***missings
sum B3038_H if Z1004=="ROU_2004"
replace A2039_8_b = B5018_H-B3038_H if Z1004=="ROU_2004"
replace A2039_8_b= B5018_H-(4.7+3.08) if B3038_H==. & Z1004=="ROU_2004"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="ROU_2004"
*tab  A2039_8_b if Z1004=="ROU_2004"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_8)/6 if Z1004=="ROU_2004"
sum  A2039 if Z1004=="ROU_2004"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_8_b)/6 if Z1004=="ROU_2004"
sum  A2039_B if Z1004=="ROU_2004"
****************************************************************************************
***SWE_2002
sum B5018_A B5018_B B5018_C B5018_D B5018_E B5018_F B5018_G B5018_H if Z1004=="SWE_2002"

*tab B3038_A if Z1004=="SWE_2002"
*tab B3038_B if Z1004=="SWE_2002"
*tab B3038_C if Z1004=="SWE_2002"
*tab B3038_D if Z1004=="SWE_2002", miss

sum B3038_A B3038_B B3038_C B3038_D B3038_E B3038_F B3038_G B3038_H if Z1004=="SWE_2002"

mvdecode B3038_A, mv(96, 97, 98, 99), if Z1004=="SWE_2002"
mvdecode B3038_B, mv(96, 97, 98, 99), if Z1004=="SWE_2002"
mvdecode B3038_C, mv(96, 97, 98, 99), if Z1004=="SWE_2002"
mvdecode B3038_D, mv(96, 97, 98, 99), if Z1004=="SWE_2002"
mvdecode B3038_E, mv(96, 97, 98, 99), if Z1004=="SWE_2002"
mvdecode B3038_F, mv(96, 97, 98, 99), if Z1004=="SWE_2002"
mvdecode B3038_G, mv(96, 97, 98, 99), if Z1004=="SWE_2002"
mvdecode B3038_H, mv(96, 97, 98, 99), if Z1004=="SWE_2002"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*6 parties 
*  EAFCDB
replace A2037_1 =1 if B3038_E< B3038_A & Z1004=="SWE_2002"
replace A2037_1 =0 if B3038_E> B3038_A & Z1004=="SWE_2002"
replace A2037_1 =0 if B3038_E == B3038_A & Z1004=="SWE_2002"
replace A2037_1 =0 if B3038_E ==. & Z1004=="SWE_2002"
replace A2037_1 =0 if B3038_A ==. & Z1004=="SWE_2002"
*list A2037_1 B3038_C B3038_A if Z1004=="SWE_2002"
*tab A2037_1 if Z1004=="SWE_2002", miss

replace A2037_2 =0 if B3038_F< B3038_A & Z1004=="SWE_2002"
replace A2037_2 =1 if B3038_F> B3038_A & Z1004=="SWE_2002"
replace A2037_2 =0 if B3038_F == B3038_A & Z1004=="SWE_2002"
replace A2037_2 =0 if B3038_F ==. & Z1004=="SWE_2002"
replace A2037_2 =0 if B3038_A ==. & Z1004=="SWE_2002"
*list A2037_2 B3038_E B3038_G if Z1004=="SWE_2002"
*tab A2037_2 if Z1004=="SWE_2002"

replace A2037_3 =1 if B3038_F< B3038_C & Z1004=="SWE_2002"
replace A2037_3 =0 if B3038_F> B3038_C & Z1004=="SWE_2002"
replace A2037_3 =0 if B3038_F == B3038_C & Z1004=="SWE_2002"
replace A2037_3 =0 if B3038_F ==. & Z1004=="SWE_2002"
replace A2037_3 =0 if B3038_C ==. & Z1004=="SWE_2002"
*list A2037_3 B3038_A B3038_B if Z1004=="SWE_2002"
*tab A2037_3 if Z1004=="SWE_2002"

replace A2037_4 =0 if B3038_C< B3038_D & Z1004=="SWE_2002"
replace A2037_4 =0 if B3038_C> B3038_D & Z1004=="SWE_2002"
replace A2037_4 =1 if B3038_C == B3038_D & Z1004=="SWE_2002" 
replace A2037_4 =0 if B3038_C ==. & Z1004=="SWE_2002"
replace A2037_4 =0 if B3038_D ==. & Z1004=="SWE_2002"
*list A2037_4 B3038_B B3038_C if Z1004=="SWE_2002" 
*tab A2037_4 if Z1004=="SWE_2002"

replace A2037_5 =1 if B3038_D< B3038_B & Z1004=="SWE_2002"
replace A2037_5 =0 if B3038_D> B3038_B & Z1004=="SWE_2002"
replace A2037_5 =0 if B3038_D == B3038_B & Z1004=="SWE_2002"
replace A2037_5 =0 if B3038_D ==. & Z1004=="SWE_2002"
replace A2037_5 =0 if B3038_B ==. & Z1004=="SWE_2002"
*list A2037_5 B3038_C B3038_D if Z1004=="SWE_2002"
*tab A2037_5 if Z1004=="SWE_2002", missing

replace A2037_6 =1 if B3038_E< B3038_B & Z1004=="SWE_2002"
replace A2037_6 =0 if B3038_E> B3038_B & Z1004=="SWE_2002"
replace A2037_6 =0 if B3038_E == B3038_B & Z1004=="SWE_2002"
replace A2037_6 =0 if B3038_E ==. & Z1004=="SWE_2002"
replace A2037_6 =0 if B3038_B ==. & Z1004=="SWE_2002"
*list A2037_6 B3038_C B3038_D if Z1004=="SWE_2002"
*tab A2037_6 if Z1004=="SWE_2002", missing


***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="SWE_2002"
*tab A2037  if Z1004=="SWE_2002"

*)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =0 if B3038_A>5 & Z1004=="SWE_2002"
replace A2038_1 =0 if B3038_A==5 & Z1004=="SWE_2002"
replace A2038_1 =1 if B3038_A<5  & Z1004=="SWE_2002"
replace A2038_1 =0 if B3038_A==.  & Z1004=="SWE_2002"
*tab A2038_1 if Z1004=="SWE_2002"

replace A2038_2 =1 if B3038_B>5 & Z1004=="SWE_2002"
replace A2038_2 =0 if B3038_B==5 & Z1004=="SWE_2002"
replace A2038_2 =0 if B3038_B<5  & Z1004=="SWE_2002"
replace A2038_2 =0 if B3038_B==.  & Z1004=="SWE_2002"
*list A2038_2 B3038_B if Z1004=="SWE_2002"
*tab A2038_2 if Z1004=="SWE_2002"

replace A2038_3 =0 if B3038_C<5 & Z1004=="SWE_2002"
replace A2038_3 =0 if B3038_C==5 & Z1004=="SWE_2002"
replace A2038_3 =1 if B3038_C>5  & Z1004=="SWE_2002"
replace A2038_3 =0 if B3038_C==.  & Z1004=="SWE_2002"
*tab A2038_3 if Z1004=="SWE_2002"
*list B3038_C A2038_3 if Z1004=="SWE_2002"

replace A2038_4 =0 if B3038_D<5 & Z1004=="SWE_2002"
replace A2038_4 =0 if B3038_D==5 & Z1004=="SWE_2002"
replace A2038_4 =1 if B3038_D>5  & Z1004=="SWE_2002"
replace A2038_4 =0 if B3038_D==.  & Z1004=="SWE_2002"
*list B3038_D A2038_4 if Z1004=="SWE_2002"
*tab A2038_4 if Z1004=="SWE_2002"

replace A2038_5 =1 if B3038_E<5 & Z1004=="SWE_2002"
replace A2038_5 =0 if B3038_E==5 & Z1004=="SWE_2002"
replace A2038_5 =0 if B3038_E>5  & Z1004=="SWE_2002"
replace A2038_5 =0 if B3038_E==.  & Z1004=="SWE_2002"
*list B3038_F A2038_5 if Z1004=="SWE_2002"
*tab A2038_5 if Z1004=="SWE_2002"

replace A2038_6 =0 if B3038_F<5 & Z1004=="SWE_2002"
replace A2038_6 =0 if B3038_F==5 & Z1004=="SWE_2002"
replace A2038_6 =1 if B3038_F>5  & Z1004=="SWE_2002"
replace A2038_6 =0 if B3038_F==.  & Z1004=="SWE_2002"
*list B3038_F A2038_6 if Z1004=="SWE_2002"
*tab A2038_6 if Z1004=="SWE_2002"



*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="SWE_2002"
*tab A2038 if Z1004=="SWE_2002"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="SWE_2002"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="SWE_2002"
*tab  A2039_1 if Z1004=="SWE_2002"
***missings
sum B3038_A if Z1004=="SWE_2002"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="SWE_2002"
replace A2039_1_b= B5018_A-(3.52+1.94) if B3038_A==. & Z1004=="SWE_2002"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="SWE_2002"
*tab  A2039_1_b if Z1004=="SWE_2002"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="SWE_2002"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="SWE_2002"
*tab  A2039_2 if Z1004=="SWE_2002"
***missings
sum B3038_B if Z1004=="SWE_2002"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="SWE_2002"
replace A2039_2_b= B5018_B-(8.95+1.52) if B3038_B==. & Z1004=="SWE_2002"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="SWE_2002"
*tab  A2039_2_b if Z1004=="SWE_2002"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="SWE_2002"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="SWE_2002"
*tab  A2039_3 if Z1004=="SWE_2002"
***missings
sum B3038_C if Z1004=="SWE_2002"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="SWE_2002"
replace A2039_3_b= B5018_C-(6.54+1.32) if B3038_C==. & Z1004=="SWE_2002"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="SWE_2002"
*tab  A2039_3_b if Z1004=="SWE_2002"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="SWE_2002"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="SWE_2002"
*tab  A2039_4 if Z1004=="SWE_2002"
***missings
sum B3038_D if Z1004=="SWE_2002"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="SWE_2002"
replace A2039_4_b= B5018_D-(7.13+1.74) if B3038_D==. & Z1004=="SWE_2002"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="SWE_2002"
*tab  A2039_4_b if Z1004=="SWE_2002"

**Party F
replace A2039_5 = B5018_F-B3038_F if Z1004=="SWE_2002"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="SWE_2002"
*tab  A2039_5 if Z1004=="SWE_2002"
***missings
sum B3038_F if Z1004=="SWE_2002"
replace A2039_5_b = B5018_F-B3038_F if Z1004=="SWE_2002"
replace A2039_5_b= B5018_F-(5.74+1.20) if B3038_F==. & Z1004=="SWE_2002"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="SWE_2002"
*tab  A2039_5_b if Z1004=="SWE_2002"

**Party E
replace A2039_6 = B5018_E-B3038_E if Z1004=="SWE_2002"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="SWE_2002"
*tab  A2039_6 if Z1004=="SWE_2002"
***missings
sum B3038_E if Z1004=="SWE_2002"
replace A2039_6_b = B5018_E-B3038_E if Z1004=="SWE_2002"
replace A2039_6_b= B5018_E-(1.31+1.46) if B3038_E==. & Z1004=="SWE_2002"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="SWE_2002"
*tab  A2039_6_b if Z1004=="SWE_2002"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6)/6 if Z1004=="SWE_2002"
sum  A2039 if Z1004=="SWE_2002"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b)/6 if Z1004=="SWE_2002"
sum  A2039_B if Z1004=="SWE_2002"

****************************************************************************************
***CHE_2003
sum B5018_A B5018_B B5018_C B5018_D B5018_E B5018_F B5018_G B5018_H if Z1004=="CHE_2003"

*tab B3038_A if Z1004=="CHE_2003"
*tab B3038_B if Z1004=="CHE_2003"
*tab B3038_C if Z1004=="CHE_2003"
*tab B3038_D if Z1004=="CHE_2003", miss

sum B3038_A B3038_B B3038_C B3038_D B3038_E B3038_F B3038_G B3038_H if Z1004=="CHE_2003"

mvdecode B3038_A, mv(96, 97, 98, 99), if Z1004=="CHE_2003"
mvdecode B3038_B, mv(96, 97, 98, 99), if Z1004=="CHE_2003"
mvdecode B3038_C, mv(96, 97, 98, 99), if Z1004=="CHE_2003"
mvdecode B3038_D, mv(96, 97, 98, 99), if Z1004=="CHE_2003"
mvdecode B3038_E, mv(96, 97, 98, 99), if Z1004=="CHE_2003"
mvdecode B3038_F, mv(96, 97, 98, 99), if Z1004=="CHE_2003"
mvdecode B3038_G, mv(96, 97, 98, 99), if Z1004=="CHE_2003"
mvdecode B3038_H, mv(96, 97, 98, 99), if Z1004=="CHE_2003"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*5 parties 
*  EBDCA
replace A2037_1 =1 if B3038_E< B3038_B & Z1004=="CHE_2003"
replace A2037_1 =0 if B3038_E> B3038_B & Z1004=="CHE_2003"
replace A2037_1 =0 if B3038_E == B3038_B & Z1004=="CHE_2003"
replace A2037_1 =0 if B3038_E ==. & Z1004=="CHE_2003"
replace A2037_1 =0 if B3038_B ==. & Z1004=="CHE_2003"
*list A2037_1 B3038_C B3038_A if Z1004=="CHE_2003"
*tab A2037_1 if Z1004=="CHE_2003", miss

replace A2037_2 =1 if B3038_B< B3038_D & Z1004=="CHE_2003"
replace A2037_2 =0 if B3038_B> B3038_D & Z1004=="CHE_2003"
replace A2037_2 =0 if B3038_B == B3038_D & Z1004=="CHE_2003"
replace A2037_2 =0 if B3038_B ==. & Z1004=="CHE_2003"
replace A2037_2 =0 if B3038_D ==. & Z1004=="CHE_2003"
*list A2037_2 B3038_E B3038_G if Z1004=="CHE_2003"
*tab A2037_2 if Z1004=="CHE_2003"

replace A2037_3 =1 if B3038_D< B3038_C & Z1004=="CHE_2003"
replace A2037_3 =0 if B3038_D> B3038_C & Z1004=="CHE_2003"
replace A2037_3 =0 if B3038_D == B3038_C & Z1004=="CHE_2003"
replace A2037_3 =0 if B3038_D ==. & Z1004=="CHE_2003"
replace A2037_3 =0 if B3038_C ==. & Z1004=="CHE_2003"
*list A2037_3 B3038_A B3038_B if Z1004=="CHE_2003"
*tab A2037_3 if Z1004=="CHE_2003"

replace A2037_4 =1 if B3038_C< B3038_A & Z1004=="CHE_2003"
replace A2037_4 =0 if B3038_C> B3038_A & Z1004=="CHE_2003"
replace A2037_4 =0 if B3038_C == B3038_A & Z1004=="CHE_2003" 
replace A2037_4 =0 if B3038_C ==. & Z1004=="CHE_2003"
replace A2037_4 =0 if B3038_A ==. & Z1004=="CHE_2003"
*list A2037_4 B3038_A B3038_C if Z1004=="CHE_2003" 
*tab A2037_4 if Z1004=="CHE_2003"

replace A2037_5 =1 if B3038_E< B3038_A & Z1004=="CHE_2003"
replace A2037_5 =0 if B3038_E> B3038_A & Z1004=="CHE_2003"
replace A2037_5 =0 if B3038_E == B3038_A & Z1004=="CHE_2003"
replace A2037_5 =0 if B3038_E ==. & Z1004=="CHE_2003"
replace A2037_5 =0 if B3038_A ==. & Z1004=="CHE_2003"
*list A2037_5 B3038_C B3038_D if Z1004=="CHE_2003"
*tab A2037_5 if Z1004=="CHE_2003", missing


***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="CHE_2003"
*tab A2037  if Z1004=="CHE_2003"

*)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =1 if B3038_A>5 & Z1004=="CHE_2003"
replace A2038_1 =0 if B3038_A==5 & Z1004=="CHE_2003"
replace A2038_1 =0 if B3038_A<5  & Z1004=="CHE_2003"
replace A2038_1 =0 if B3038_A==.  & Z1004=="CHE_2003"
*tab A2038_1 if Z1004=="CHE_2003"

replace A2038_2 =0 if B3038_B>5 & Z1004=="CHE_2003"
replace A2038_2 =0 if B3038_B==5 & Z1004=="CHE_2003"
replace A2038_2 =1 if B3038_B<5  & Z1004=="CHE_2003"
replace A2038_2 =0 if B3038_B==.  & Z1004=="CHE_2003"
*list A2038_2 B3038_B if Z1004=="CHE_2003"
*tab A2038_2 if Z1004=="CHE_2003"

replace A2038_3 =0 if B3038_C<5 & Z1004=="CHE_2003"
replace A2038_3 =0 if B3038_C==5 & Z1004=="CHE_2003"
replace A2038_3 =1 if B3038_C>5  & Z1004=="CHE_2003"
replace A2038_3 =0 if B3038_C==.  & Z1004=="CHE_2003"
*tab A2038_3 if Z1004=="CHE_2003"
*list B3038_C A2038_3 if Z1004=="CHE_2003"

replace A2038_4 =0 if B3038_D<5 & Z1004=="CHE_2003"
replace A2038_4 =0 if B3038_D==5 & Z1004=="CHE_2003"
replace A2038_4 =1 if B3038_D>5  & Z1004=="CHE_2003"
replace A2038_4 =0 if B3038_D==.  & Z1004=="CHE_2003"
*list B3038_D A2038_4 if Z1004=="CHE_2003"
*tab A2038_4 if Z1004=="CHE_2003"

replace A2038_5 =1 if B3038_E<5 & Z1004=="CHE_2003"
replace A2038_5 =0 if B3038_E==5 & Z1004=="CHE_2003"
replace A2038_5 =0 if B3038_E>5  & Z1004=="CHE_2003"
replace A2038_5 =0 if B3038_E==.  & Z1004=="CHE_2003"
*list B3038_F A2038_5 if Z1004=="CHE_2003"
*tab A2038_5 if Z1004=="CHE_2003"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="CHE_2003"
*tab A2038 if Z1004=="CHE_2003"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="CHE_2003"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="CHE_2003"
*tab  A2039_1 if Z1004=="CHE_2003"
***missings
sum B3038_A if Z1004=="CHE_2003"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="CHE_2003"
replace A2039_1_b= B5018_A-(8.17+2.26) if B3038_A==. & Z1004=="CHE_2003"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="CHE_2003"
*tab  A2039_1_b if Z1004=="CHE_2003"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="CHE_2003"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="CHE_2003"
*tab  A2039_2 if Z1004=="CHE_2003"
***missings
sum B3038_B if Z1004=="CHE_2003"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="CHE_2003"
replace A2039_2_b= B5018_B-(2.81+2.09) if B3038_B==. & Z1004=="CHE_2003"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="CHE_2003"
*tab  A2039_2_b if Z1004=="CHE_2003"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="CHE_2003"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="CHE_2003"
*tab  A2039_3 if Z1004=="CHE_2003"
***missings
sum B3038_C if Z1004=="CHE_2003"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="CHE_2003"
replace A2039_3_b= B5018_C-(6.22+1.69) if B3038_C==. & Z1004=="CHE_2003"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="CHE_2003"
*tab  A2039_3_b if Z1004=="CHE_2003"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="CHE_2003"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="CHE_2003"
*tab  A2039_4 if Z1004=="CHE_2003"
***missings
sum B3038_D if Z1004=="CHE_2003"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="CHE_2003"
replace A2039_4_b= B5018_D-(5.48+1.66) if B3038_D==. & Z1004=="CHE_2003"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="CHE_2003"
*tab  A2039_4_b if Z1004=="CHE_2003"

**Party E
replace A2039_6 = B5018_E-B3038_E if Z1004=="CHE_2003"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="CHE_2003"
*tab  A2039_6 if Z1004=="CHE_2003"
***missings
sum B3038_E if Z1004=="CHE_2003"
replace A2039_6_b = B5018_E-B3038_E if Z1004=="CHE_2003"
replace A2039_6_b= B5018_E-(2.91+2.03) if B3038_E==. & Z1004=="CHE_2003"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="CHE_2003"
*tab  A2039_6_b if Z1004=="CHE_2003"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_6)/5 if Z1004=="CHE_2003"
sum  A2039 if Z1004=="CHE_2003"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_6_b)/5 if Z1004=="CHE_2003"
sum  A2039_B if Z1004=="CHE_2003"
****************************************************************************************
***MEX_2003
sum B5018_A B5018_B B5018_C B5018_D B5018_E B5018_F B5018_G B5018_H if Z1004=="MEX_2003"

*tab B3038_A if Z1004=="MEX_2003"
*tab B3038_B if Z1004=="MEX_2003"
*tab B3038_C if Z1004=="MEX_2003"
*tab B3038_D if Z1004=="MEX_2003", miss

sum B3038_A B3038_B B3038_C B3038_D B3038_E B3038_F B3038_G B3038_H if Z1004=="MEX_2003"

mvdecode B3038_A, mv(96, 97, 98, 99), if Z1004=="MEX_2003"
mvdecode B3038_B, mv(96, 97, 98, 99), if Z1004=="MEX_2003"
mvdecode B3038_C, mv(96, 97, 98, 99), if Z1004=="MEX_2003"
mvdecode B3038_D, mv(96, 97, 98, 99), if Z1004=="MEX_2003"
mvdecode B3038_E, mv(96, 97, 98, 99), if Z1004=="MEX_2003"
mvdecode B3038_F, mv(96, 97, 98, 99), if Z1004=="MEX_2003"
mvdecode B3038_G, mv(96, 97, 98, 99), if Z1004=="MEX_2003"
mvdecode B3038_H, mv(96, 97, 98, 99), if Z1004=="MEX_2003"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*5 parties 
*  ECBFDA
replace A2037_1 =1 if B3038_E< B3038_C & Z1004=="MEX_2003"
replace A2037_1 =0 if B3038_E> B3038_C & Z1004=="MEX_2003"
replace A2037_1 =0 if B3038_E == B3038_C & Z1004=="MEX_2003"
replace A2037_1 =0 if B3038_E ==. & Z1004=="MEX_2003"
replace A2037_1 =0 if B3038_C ==. & Z1004=="MEX_2003"
*list A2037_1 B3038_C B3038_A if Z1004=="MEX_2003"
*tab A2037_1 if Z1004=="MEX_2003", miss

replace A2037_2 =1 if B3038_C< B3038_B & Z1004=="MEX_2003"
replace A2037_2 =0 if B3038_C> B3038_B & Z1004=="MEX_2003"
replace A2037_2 =0 if B3038_C == B3038_B & Z1004=="MEX_2003"
replace A2037_2 =0 if B3038_C ==. & Z1004=="MEX_2003"
replace A2037_2 =0 if B3038_B ==. & Z1004=="MEX_2003"
*list A2037_2 B3038_E B3038_G if Z1004=="MEX_2003"
*tab A2037_2 if Z1004=="MEX_2003"

replace A2037_3 =0 if B3038_B< B3038_F & Z1004=="MEX_2003"
replace A2037_3 =0 if B3038_B> B3038_F & Z1004=="MEX_2003"
replace A2037_3 =1 if B3038_B == B3038_F & Z1004=="MEX_2003"
replace A2037_3 =0 if B3038_B ==. & Z1004=="MEX_2003"
replace A2037_3 =0 if B3038_F ==. & Z1004=="MEX_2003"
*list A2037_3 B3038_A B3038_B if Z1004=="MEX_2003"
*tab A2037_3 if Z1004=="MEX_2003"

replace A2037_4 =1 if B3038_F< B3038_D & Z1004=="MEX_2003"
replace A2037_4 =0 if B3038_F> B3038_D & Z1004=="MEX_2003"
replace A2037_4 =0 if B3038_F == B3038_D & Z1004=="MEX_2003" 
replace A2037_4 =0 if B3038_F ==. & Z1004=="MEX_2003"
replace A2037_4 =0 if B3038_D ==. & Z1004=="MEX_2003"
*list A2037_4 B3038_A B3038_C if Z1004=="MEX_2003" 
*tab A2037_4 if Z1004=="MEX_2003"

replace A2037_5 =1 if B3038_D< B3038_A & Z1004=="MEX_2003"
replace A2037_5 =0 if B3038_D> B3038_A & Z1004=="MEX_2003"
replace A2037_5 =0 if B3038_D == B3038_A & Z1004=="MEX_2003"
replace A2037_5 =0 if B3038_D ==. & Z1004=="MEX_2003"
replace A2037_5 =0 if B3038_A ==. & Z1004=="MEX_2003"
*list A2037_5 B3038_C B3038_D if Z1004=="MEX_2003"
*tab A2037_5 if Z1004=="MEX_2003", missing

replace A2037_6 =1 if B3038_E< B3038_A & Z1004=="MEX_2003"
replace A2037_6 =0 if B3038_E> B3038_A & Z1004=="MEX_2003"
replace A2037_6 =0 if B3038_E == B3038_A & Z1004=="MEX_2003"
replace A2037_6 =0 if B3038_E ==. & Z1004=="MEX_2003"
replace A2037_6 =0 if B3038_A ==. & Z1004=="MEX_2003"
*list A2037_6 B3038_C B3038_D if Z1004=="MEX_2003"
*tab A2037_6 if Z1004=="MEX_2003", missing


***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="MEX_2003"
*tab A2037  if Z1004=="MEX_2003"

*)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =1 if B3038_A>5 & Z1004=="MEX_2003"
replace A2038_1 =0 if B3038_A==5 & Z1004=="MEX_2003"
replace A2038_1 =0 if B3038_A<5  & Z1004=="MEX_2003"
replace A2038_1 =0 if B3038_A==.  & Z1004=="MEX_2003"
*tab A2038_1 if Z1004=="MEX_2003"

replace A2038_2 =0 if B3038_B>5 & Z1004=="MEX_2003"
replace A2038_2 =1 if B3038_B==5 & Z1004=="MEX_2003"
replace A2038_2 =0 if B3038_B<5  & Z1004=="MEX_2003"
replace A2038_2 =0 if B3038_B==.  & Z1004=="MEX_2003"
*list A2038_2 B3038_B if Z1004=="MEX_2003"
*tab A2038_2 if Z1004=="MEX_2003"

replace A2038_3 =1 if B3038_C<5 & Z1004=="MEX_2003"
replace A2038_3 =0 if B3038_C==5 & Z1004=="MEX_2003"
replace A2038_3 =0 if B3038_C>5  & Z1004=="MEX_2003"
replace A2038_3 =0 if B3038_C==.  & Z1004=="MEX_2003"
*tab A2038_3 if Z1004=="MEX_2003"
*list B3038_C A2038_3 if Z1004=="MEX_2003"

replace A2038_4 =0 if B3038_D<5 & Z1004=="MEX_2003"
replace A2038_4 =0 if B3038_D==5 & Z1004=="MEX_2003"
replace A2038_4 =1 if B3038_D>5  & Z1004=="MEX_2003"
replace A2038_4 =0 if B3038_D==.  & Z1004=="MEX_2003"
*list B3038_D A2038_4 if Z1004=="MEX_2003"
*tab A2038_4 if Z1004=="MEX_2003"

replace A2038_5 =1 if B3038_E<5 & Z1004=="MEX_2003"
replace A2038_5 =0 if B3038_E==5 & Z1004=="MEX_2003"
replace A2038_5 =0 if B3038_E>5  & Z1004=="MEX_2003"
replace A2038_5 =0 if B3038_E==.  & Z1004=="MEX_2003"
*list B3038_F A2038_5 if Z1004=="MEX_2003"
*tab A2038_5 if Z1004=="MEX_2003"

replace A2038_6 =0 if B3038_F<5 & Z1004=="MEX_2003"
replace A2038_6 =1 if B3038_F==5 & Z1004=="MEX_2003"
replace A2038_6 =0 if B3038_F>5  & Z1004=="MEX_2003"
replace A2038_6 =0 if B3038_F==.  & Z1004=="MEX_2003"
*list B3038_F A2038_6 if Z1004=="MEX_2003"
*tab A2038_6 if Z1004=="MEX_2003"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="MEX_2003"
*tab A2038 if Z1004=="MEX_2003"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="MEX_2003"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="MEX_2003"
*tab  A2039_1 if Z1004=="MEX_2003"
***missings
sum B3038_A if Z1004=="MEX_2003"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="MEX_2003"
replace A2039_1_b= B5018_A-(6.33+3.62) if B3038_A==. & Z1004=="MEX_2003"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="MEX_2003"
*tab  A2039_1_b if Z1004=="MEX_2003"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="MEX_2003"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="MEX_2003"
*tab  A2039_2 if Z1004=="MEX_2003"
***missings
sum B3038_B if Z1004=="MEX_2003"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="MEX_2003"
replace A2039_2_b= B5018_B-(5.59+3.72) if B3038_B==. & Z1004=="MEX_2003"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="MEX_2003"
*tab  A2039_2_b if Z1004=="MEX_2003"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="MEX_2003"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="MEX_2003"
*tab  A2039_3 if Z1004=="MEX_2003"
***missings
sum B3038_C if Z1004=="MEX_2003"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="MEX_2003"
replace A2039_3_b= B5018_C-(3.83+3.37) if B3038_C==. & Z1004=="MEX_2003"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="MEX_2003"
*tab  A2039_3_b if Z1004=="MEX_2003"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="MEX_2003"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="MEX_2003"
*tab  A2039_4 if Z1004=="MEX_2003"
***missings
sum B3038_D if Z1004=="MEX_2003"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="MEX_2003"
replace A2039_4_b= B5018_D-(4.19+3.56) if B3038_D==. & Z1004=="MEX_2003"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="MEX_2003"
*tab  A2039_4_b if Z1004=="MEX_2003"

**Party F
replace A2039_5 = B5018_F-B3038_F if Z1004=="MEX_2003"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="MEX_2003"
*tab  A2039_5 if Z1004=="MEX_2003"
***missings
sum B3038_F if Z1004=="MEX_2003"
replace A2039_5_b = B5018_F-B3038_F if Z1004=="MEX_2003"
replace A2039_5_b= B5018_F-(2.51+3.08) if B3038_F==. & Z1004=="MEX_2003"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="MEX_2003"
*tab  A2039_5_b if Z1004=="MEX_2003"

**Party E
replace A2039_6 = B5018_E-B3038_E if Z1004=="MEX_2003"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="MEX_2003"
*tab  A2039_6 if Z1004=="MEX_2003"
***missings
sum B3038_E if Z1004=="MEX_2003"
replace A2039_6_b = B5018_E-B3038_E if Z1004=="MEX_2003"
replace A2039_6_b= B5018_E-(2.58+2.98) if B3038_E==. & Z1004=="MEX_2003"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="MEX_2003"
*tab  A2039_6_b if Z1004=="MEX_2003"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_6+A2039_5)/6 if Z1004=="MEX_2003"
sum  A2039 if Z1004=="MEX_2003"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_6_b+A2039_5_b)/6 if Z1004=="MEX_2003"
sum  A2039_B if Z1004=="MEX_2003"

****************************************************************************************
**DEU12002

sum B5018_A B5018_B B5018_C B5018_D B5018_E B5018_F B5018_G B5018_H if Z1004=="DEU12002"
sum B5018_A B5018_B B5018_C B5018_D B5018_E B5018_F B5018_G B5018_H if Z1004=="DEU22002"

*tab B3038_A if Z1004=="DEU12002"
*tab B3038_B if Z1004=="DEU12002"
*tab B3038_C if Z1004=="DEU12002"
*tab B3038_D if Z1004=="DEU12002", miss

sum B3038_A B3038_B B3038_C B3038_D B3038_E B3038_F B3038_G B3038_H if Z1004=="DEU12002"

mvdecode B3038_A, mv(96, 97, 98, 99), if Z1004=="DEU12002"
mvdecode B3038_B, mv(96, 97, 98, 99), if Z1004=="DEU12002"
mvdecode B3038_C, mv(96, 97, 98, 99), if Z1004=="DEU12002"
mvdecode B3038_D, mv(96, 97, 98, 99), if Z1004=="DEU12002"
mvdecode B3038_E, mv(96, 97, 98, 99), if Z1004=="DEU12002"
mvdecode B3038_F, mv(96, 97, 98, 99), if Z1004=="DEU12002"
mvdecode B3038_G, mv(96, 97, 98, 99), if Z1004=="DEU12002"
mvdecode B3038_H, mv(96, 97, 98, 99), if Z1004=="DEU12002"
mvdecode B3038_A, mv(96, 97, 98, 99), if Z1004=="DEU22002"
mvdecode B3038_B, mv(96, 97, 98, 99), if Z1004=="DEU22002"
mvdecode B3038_C, mv(96, 97, 98, 99), if Z1004=="DEU22002"
mvdecode B3038_D, mv(96, 97, 98, 99), if Z1004=="DEU22002"
mvdecode B3038_E, mv(96, 97, 98, 99), if Z1004=="DEU22002"
mvdecode B3038_F, mv(96, 97, 98, 99), if Z1004=="DEU22002"
mvdecode B3038_G, mv(96, 97, 98, 99), if Z1004=="DEU22002"
mvdecode B3038_H, mv(96, 97, 98, 99), if Z1004=="DEU22002"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*6 parties 
*  FDAEBC
replace A2037_1 =1 if B3038_F< B3038_D & Z1004=="DEU12002"
replace A2037_1 =0 if B3038_F> B3038_D & Z1004=="DEU12002"
replace A2037_1 =0 if B3038_F == B3038_D & Z1004=="DEU12002"
replace A2037_1 =0 if B3038_F ==. & Z1004=="DEU12002"
replace A2037_1 =0 if B3038_D ==. & Z1004=="DEU12002"
*list A2037_1 B3038_C B3038_A if Z1004=="DEU12002"
*tab A2037_1 if Z1004=="DEU12002", miss

replace A2037_1 =1 if B3038_F< B3038_D & Z1004=="DEU22002"
replace A2037_1 =0 if B3038_F> B3038_D & Z1004=="DEU22002"
replace A2037_1 =0 if B3038_F == B3038_D & Z1004=="DEU22002"
replace A2037_1 =0 if B3038_F ==. & Z1004=="DEU22002"
replace A2037_1 =0 if B3038_D ==. & Z1004=="DEU22002"
*list A2037_1 B3038_C B3038_A if Z1004=="DEU22002"
*tab A2037_1 if Z1004=="DEU22002", miss

replace A2037_2 =1 if B3038_D< B3038_A & Z1004=="DEU12002"
replace A2037_2 =0 if B3038_D> B3038_A & Z1004=="DEU12002"
replace A2037_2 =0 if B3038_D == B3038_A & Z1004=="DEU12002"
replace A2037_2 =0 if B3038_D ==. & Z1004=="DEU12002"
replace A2037_2 =0 if B3038_A ==. & Z1004=="DEU12002"
*list A2037_2 B3038_E B3038_G if Z1004=="DEU12002"
*tab A2037_2 if Z1004=="DEU12002"

replace A2037_2 =1 if B3038_D< B3038_A & Z1004=="DEU22002"
replace A2037_2 =0 if B3038_D> B3038_A & Z1004=="DEU22002"
replace A2037_2 =0 if B3038_D == B3038_A & Z1004=="DEU22002"
replace A2037_2 =0 if B3038_D ==. & Z1004=="DEU22002"
replace A2037_2 =0 if B3038_A ==. & Z1004=="DEU22002"
*list A2037_2 B3038_E B3038_G if Z1004=="DEU22002"
*tab A2037_2 if Z1004=="DEU22002"

replace A2037_3 =1 if B3038_A< B3038_E & Z1004=="DEU12002"
replace A2037_3 =0 if B3038_A> B3038_E & Z1004=="DEU12002"
replace A2037_3 =0 if B3038_A == B3038_E & Z1004=="DEU12002"
replace A2037_3 =0 if B3038_A ==. & Z1004=="DEU12002"
replace A2037_3 =0 if B3038_E ==. & Z1004=="DEU12002"
*list A2037_3 B3038_A B3038_B if Z1004=="DEU12002"
*tab A2037_3 if Z1004=="DEU12002"

replace A2037_3 =1 if B3038_A< B3038_E & Z1004=="DEU22002"
replace A2037_3 =0 if B3038_A> B3038_E & Z1004=="DEU22002"
replace A2037_3 =0 if B3038_A == B3038_E & Z1004=="DEU22002"
replace A2037_3 =0 if B3038_A ==. & Z1004=="DEU22002"
replace A2037_3 =0 if B3038_E ==. & Z1004=="DEU22002"
*list A2037_3 B3038_A B3038_B if Z1004=="DEU22002"
*tab A2037_3 if Z1004=="DEU22002"

replace A2037_4 =1 if B3038_E< B3038_B & Z1004=="DEU12002"
replace A2037_4 =0 if B3038_E> B3038_B & Z1004=="DEU12002"
replace A2037_4 =0 if B3038_E == B3038_B & Z1004=="DEU12002" 
replace A2037_4 =0 if B3038_E ==. & Z1004=="DEU12002"
replace A2037_4 =0 if B3038_B ==. & Z1004=="DEU12002"
*list A2037_4 B3038_A B3038_C if Z1004=="DEU12002" 
*tab A2037_4 if Z1004=="DEU12002"

replace A2037_4 =1 if B3038_E< B3038_B & Z1004=="DEU22002"
replace A2037_4 =0 if B3038_E> B3038_B & Z1004=="DEU22002"
replace A2037_4 =0 if B3038_E == B3038_B & Z1004=="DEU22002" 
replace A2037_4 =0 if B3038_E ==. & Z1004=="DEU22002"
replace A2037_4 =0 if B3038_B ==. & Z1004=="DEU22002"
*list A2037_4 B3038_A B3038_C if Z1004=="DEU22002" 
*tab A2037_4 if Z1004=="DEU22002"

replace A2037_5 =1 if B3038_B< B3038_C & Z1004=="DEU12002"
replace A2037_5 =0 if B3038_B> B3038_C & Z1004=="DEU12002"
replace A2037_5 =0 if B3038_B == B3038_C & Z1004=="DEU12002"
replace A2037_5 =0 if B3038_B ==. & Z1004=="DEU12002"
replace A2037_5 =0 if B3038_C ==. & Z1004=="DEU12002"
*list A2037_5 B3038_C B3038_D if Z1004=="DEU12002"
*tab A2037_5 if Z1004=="DEU12002", missing

replace A2037_5 =1 if B3038_B< B3038_C & Z1004=="DEU22002"
replace A2037_5 =0 if B3038_B> B3038_C & Z1004=="DEU22002"
replace A2037_5 =0 if B3038_B == B3038_C & Z1004=="DEU22002"
replace A2037_5 =0 if B3038_B ==. & Z1004=="DEU22002"
replace A2037_5 =0 if B3038_C ==. & Z1004=="DEU22002"
*list A2037_5 B3038_C B3038_D if Z1004=="DEU22002"
*tab A2037_5 if Z1004=="DEU22002", missing

replace A2037_6 =1 if B3038_F< B3038_C & Z1004=="DEU12002"
replace A2037_6 =0 if B3038_F> B3038_C & Z1004=="DEU12002"
replace A2037_6 =0 if B3038_F == B3038_C & Z1004=="DEU12002"
replace A2037_6 =0 if B3038_F ==. & Z1004=="DEU12002"
replace A2037_6 =0 if B3038_C ==. & Z1004=="DEU12002"
*list A2037_6 B3038_C B3038_D if Z1004=="DEU12002"
*tab A2037_6 if Z1004=="DEU12002", missing

replace A2037_6 =1 if B3038_F< B3038_C & Z1004=="DEU22002"
replace A2037_6 =0 if B3038_F> B3038_C & Z1004=="DEU22002"
replace A2037_6 =0 if B3038_F == B3038_C & Z1004=="DEU22002"
replace A2037_6 =0 if B3038_F ==. & Z1004=="DEU22002"
replace A2037_6 =0 if B3038_C ==. & Z1004=="DEU22002"
*list A2037_6 B3038_C B3038_D if Z1004=="DEU22002"
*tab A2037_6 if Z1004=="DEU22002", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="DEU12002"
*tab A2037  if Z1004=="DEU12002"

replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="DEU22002"
*tab A2037  if Z1004=="DEU22002"

*)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =0 if B3038_A>5 & Z1004=="DEU12002"
replace A2038_1 =0 if B3038_A==5 & Z1004=="DEU12002"
replace A2038_1 =1 if B3038_A<5  & Z1004=="DEU12002"
replace A2038_1 =0 if B3038_A==.  & Z1004=="DEU12002"
*tab A2038_1 if Z1004=="DEU12002"
replace A2038_1 =0 if B3038_A>5 & Z1004=="DEU22002"
replace A2038_1 =0 if B3038_A==5 & Z1004=="DEU22002"
replace A2038_1 =1 if B3038_A<5  & Z1004=="DEU22002"
replace A2038_1 =0 if B3038_A==.  & Z1004=="DEU22002"
*tab A2038_1 if Z1004=="DEU22002"


replace A2038_2 =1 if B3038_B>5 & Z1004=="DEU12002"
replace A2038_2 =0 if B3038_B==5 & Z1004=="DEU12002"
replace A2038_2 =0 if B3038_B<5  & Z1004=="DEU12002"
replace A2038_2 =0 if B3038_B==.  & Z1004=="DEU12002"
*list A2038_2 B3038_B if Z1004=="DEU12002"
*tab A2038_2 if Z1004=="DEU12002"
replace A2038_2 =1 if B3038_B>5 & Z1004=="DEU22002"
replace A2038_2 =0 if B3038_B==5 & Z1004=="DEU22002"
replace A2038_2 =0 if B3038_B<5  & Z1004=="DEU22002"
replace A2038_2 =0 if B3038_B==.  & Z1004=="DEU22002"
*list A2038_2 B3038_B if Z1004=="DEU22002"
*tab A2038_2 if Z1004=="DEU22002"


replace A2038_3 =0 if B3038_C<5 & Z1004=="DEU12002"
replace A2038_3 =0 if B3038_C==5 & Z1004=="DEU12002"
replace A2038_3 =1 if B3038_C>5  & Z1004=="DEU12002"
replace A2038_3 =0 if B3038_C==.  & Z1004=="DEU12002"
*tab A2038_3 if Z1004=="DEU12002"
*list B3038_C A2038_3 if Z1004=="DEU12002"
replace A2038_3 =0 if B3038_C<5 & Z1004=="DEU22002"
replace A2038_3 =0 if B3038_C==5 & Z1004=="DEU22002"
replace A2038_3 =1 if B3038_C>5  & Z1004=="DEU22002"
replace A2038_3 =0 if B3038_C==.  & Z1004=="DEU22002"
*tab A2038_3 if Z1004=="DEU22002"
*list B3038_C A2038_3 if Z1004=="DEU22002"


replace A2038_4 =1 if B3038_D<5 & Z1004=="DEU12002"
replace A2038_4 =0 if B3038_D==5 & Z1004=="DEU12002"
replace A2038_4 =0 if B3038_D>5  & Z1004=="DEU12002"
replace A2038_4 =0 if B3038_D==.  & Z1004=="DEU12002"
*list B3038_D A2038_4 if Z1004=="DEU12002"
*tab A2038_4 if Z1004=="DEU12002"
replace A2038_4 =1 if B3038_D<5 & Z1004=="DEU22002"
replace A2038_4 =0 if B3038_D==5 & Z1004=="DEU22002"
replace A2038_4 =0 if B3038_D>5  & Z1004=="DEU22002"
replace A2038_4 =0 if B3038_D==.  & Z1004=="DEU22002"
*list B3038_D A2038_4 if Z1004=="DEU22002"
*tab A2038_4 if Z1004=="DEU22002"


replace A2038_5 =0 if B3038_E<5 & Z1004=="DEU12002"
replace A2038_5 =0 if B3038_E==5 & Z1004=="DEU12002"
replace A2038_5 =1 if B3038_E>5  & Z1004=="DEU12002"
replace A2038_5 =0 if B3038_E==.  & Z1004=="DEU12002"
*list B3038_F A2038_5 if Z1004=="DEU12002"
*tab A2038_5 if Z1004=="DEU12002"
replace A2038_5 =0 if B3038_E<5 & Z1004=="DEU22002"
replace A2038_5 =0 if B3038_E==5 & Z1004=="DEU22002"
replace A2038_5 =1 if B3038_E>5  & Z1004=="DEU22002"
replace A2038_5 =0 if B3038_E==.  & Z1004=="DEU22002"
*list B3038_F A2038_5 if Z1004=="DEU22002"
*tab A2038_5 if Z1004=="DEU22002"

replace A2038_6 =1 if B3038_F<5 & Z1004=="DEU12002"
replace A2038_6 =0 if B3038_F==5 & Z1004=="DEU12002"
replace A2038_6 =0 if B3038_F>5  & Z1004=="DEU12002"
replace A2038_6 =0 if B3038_F==.  & Z1004=="DEU12002"
*list B3038_F A2038_6 if Z1004=="DEU12002"
*tab A2038_6 if Z1004=="DEU12002"
replace A2038_6 =1 if B3038_F<5 & Z1004=="DEU22002"
replace A2038_6 =0 if B3038_F==5 & Z1004=="DEU22002"
replace A2038_6 =0 if B3038_F>5  & Z1004=="DEU22002"
replace A2038_6 =0 if B3038_F==.  & Z1004=="DEU22002"
*list B3038_F A2038_6 if Z1004=="DEU22002"
*tab A2038_6 if Z1004=="DEU22002"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="DEU12002"
*tab A2038 if Z1004=="DEU12002"
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="DEU22002"
*tab A2038 if Z1004=="DEU22002"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="DEU12002"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="DEU12002"
*tab  A2039_1 if Z1004=="DEU12002"
***missings
sum B3038_A if Z1004=="DEU12002"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="DEU12002"
replace A2039_1_b= B5018_A-(3.35+2.13) if B3038_A==. & Z1004=="DEU12002"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="DEU12002"
*tab  A2039_1_b if Z1004=="DEU12002"
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="DEU22002"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="DEU22002"
*tab  A2039_1 if Z1004=="DEU22002"
***missings
sum B3038_A if Z1004=="DEU22002"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="DEU22002"
replace A2039_1_b= B5018_A-(3.23+1.52) if B3038_A==. & Z1004=="DEU22002"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="DEU22002"
*tab  A2039_1_b if Z1004=="DEU22002"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="DEU12002"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="DEU12002"
*tab  A2039_2 if Z1004=="DEU12002"
***missings
sum B3038_B if Z1004=="DEU12002"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="DEU12002"
replace A2039_2_b= B5018_B-(6.08+2.33) if B3038_B==. & Z1004=="DEU12002"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="DEU12002"
*tab  A2039_2_b if Z1004=="DEU12002"
**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="DEU22002"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="DEU22002"
*tab  A2039_2 if Z1004=="DEU22002"
***missings
sum B3038_B if Z1004=="DEU22002"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="DEU22002"
replace A2039_2_b= B5018_B-(6.74+1.73) if B3038_B==. & Z1004=="DEU22002"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="DEU22002"
*tab  A2039_2_b if Z1004=="DEU22002"


**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="DEU12002"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="DEU12002"
*tab  A2039_3 if Z1004=="DEU12002"
***missings
sum B3038_C if Z1004=="DEU12002"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="DEU12002"
replace A2039_3_b= B5018_C-(6.59+2.51) if B3038_C==. & Z1004=="DEU12002"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="DEU12002"
*tab  A2039_3_b if Z1004=="DEU12002"
**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="DEU22002"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="DEU22002"
*tab  A2039_3 if Z1004=="DEU22002"
***missings
sum B3038_C if Z1004=="DEU22002"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="DEU22002"
replace A2039_3_b= B5018_C-(7.54+1.961) if B3038_C==. & Z1004=="DEU22002"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="DEU22002"
*tab  A2039_3_b if Z1004=="DEU22002"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="DEU12002"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="DEU12002"
*tab  A2039_4 if Z1004=="DEU12002"
***missings
sum B3038_D if Z1004=="DEU12002"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="DEU12002"
replace A2039_4_b= B5018_D-(3.01+2.07) if B3038_D==. & Z1004=="DEU12002"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="DEU12002"
*tab  A2039_4_b if Z1004=="DEU12002"
**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="DEU22002"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="DEU22002"
*tab  A2039_4 if Z1004=="DEU22002"
***missings
sum B3038_D if Z1004=="DEU22002"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="DEU22002"
replace A2039_4_b= B5018_D-(2.61+1.64) if B3038_D==. & Z1004=="DEU22002"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="DEU22002"
*tab  A2039_4_b if Z1004=="DEU22002"

**Party F
replace A2039_5 = B5018_F-B3038_F if Z1004=="DEU12002"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="DEU12002"
*tab  A2039_5 if Z1004=="DEU12002"
***missings
sum B3038_F if Z1004=="DEU12002"
replace A2039_5_b = B5018_F-B3038_F if Z1004=="DEU12002"
replace A2039_5_b= B5018_F-(1.93+2.72) if B3038_F==. & Z1004=="DEU12002"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="DEU12002"
*tab  A2039_5_b if Z1004=="DEU12002"
**Party F
replace A2039_5 = B5018_F-B3038_F if Z1004=="DEU22002"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="DEU22002"
*tab  A2039_5 if Z1004=="DEU22002"
***missings
sum B3038_F if Z1004=="DEU22002"
replace A2039_5_b = B5018_F-B3038_F if Z1004=="DEU22002"
replace A2039_5_b= B5018_F-(1.67+2.63) if B3038_F==. & Z1004=="DEU22002"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="DEU22002"
*tab  A2039_5_b if Z1004=="DEU22002"

**Party E
replace A2039_6 = B5018_E-B3038_E if Z1004=="DEU12002"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="DEU12002"
*tab  A2039_6 if Z1004=="DEU12002"
***missings
sum B3038_E if Z1004=="DEU12002"
replace A2039_6_b = B5018_E-B3038_E if Z1004=="DEU12002"
replace A2039_6_b= B5018_E-(4.90+2.0) if B3038_E==. & Z1004=="DEU12002"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="DEU12002"
*tab  A2039_6_b if Z1004=="DEU12002"
**Party E
replace A2039_6 = B5018_E-B3038_E if Z1004=="DEU22002"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="DEU22002"
*tab  A2039_6 if Z1004=="DEU22002"
***missings
sum B3038_E if Z1004=="DEU22002"
replace A2039_6_b = B5018_E-B3038_E if Z1004=="DEU22002"
replace A2039_6_b= B5018_E-(5.53+1.55) if B3038_E==. & Z1004=="DEU22002"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="DEU22002"
*tab  A2039_6_b if Z1004=="DEU22002"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_6+A2039_5)/6 if Z1004=="DEU12002"
sum  A2039 if Z1004=="DEU12002"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_6_b+A2039_5_b)/6 if Z1004=="DEU12002"
sum  A2039_B if Z1004=="DEU12002"

replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_6+A2039_5)/6 if Z1004=="DEU22002"
sum  A2039 if Z1004=="DEU22002"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_6_b+A2039_5_b)/6 if Z1004=="DEU22002"
sum  A2039_B if Z1004=="DEU22002"

**************************************************************************************
sum B5018_A B5018_B B5018_C B5018_D B5018_E B5018_F B5018_G B5018_H if Z1004=="ESP_2004"
***NO ONE KNOWS ABOUT PARTY D, THIS IS DIFFICULT

*tab B3038_A if Z1004=="ESP_2004"
*tab B3038_B if Z1004=="ESP_2004"
*tab B3038_C if Z1004=="ESP_2004"
*tab B3038_D if Z1004=="ESP_2004", miss

sum B3038_A B3038_B B3038_C B3038_D B3038_E B3038_F B3038_G B3038_H if Z1004=="ESP_2004"

mvdecode B3038_A, mv(96, 97, 98, 99), if Z1004=="ESP_2004"
mvdecode B3038_B, mv(96, 97, 98, 99), if Z1004=="ESP_2004"
mvdecode B3038_C, mv(96, 97, 98, 99), if Z1004=="ESP_2004"
mvdecode B3038_D, mv(96, 97, 98, 99), if Z1004=="ESP_2004"
mvdecode B3038_E, mv(96, 97, 98, 99), if Z1004=="ESP_2004"
mvdecode B3038_F, mv(96, 97, 98, 99), if Z1004=="ESP_2004"
mvdecode B3038_G, mv(96, 97, 98, 99), if Z1004=="ESP_2004"
mvdecode B3038_H, mv(96, 97, 98, 99), if Z1004=="ESP_2004"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*4 parties 
*  CADB
replace A2037_1 =1 if B3038_C< B3038_A & Z1004=="ESP_2004"
replace A2037_1 =0 if B3038_C> B3038_A & Z1004=="ESP_2004"
replace A2037_1 =0 if B3038_C == B3038_A & Z1004=="ESP_2004"
replace A2037_1 =0 if B3038_C ==. & Z1004=="ESP_2004"
replace A2037_1 =0 if B3038_A ==. & Z1004=="ESP_2004"
*list A2037_1 B3038_C B3038_A if Z1004=="ESP_2004"
*tab A2037_1 if Z1004=="ESP_2004", miss

replace A2037_2 =1 if B3038_A< B3038_D & Z1004=="ESP_2004"
replace A2037_2 =0 if B3038_A> B3038_D & Z1004=="ESP_2004"
replace A2037_2 =0 if B3038_A == B3038_D & Z1004=="ESP_2004"
replace A2037_2 =0 if B3038_A ==. & Z1004=="ESP_2004"
replace A2037_2 =0 if B3038_D ==. & Z1004=="ESP_2004"
*list A2037_2 B3038_E B3038_G if Z1004=="ESP_2004"
*tab A2037_2 if Z1004=="ESP_2004"

replace A2037_3 =0 if B3038_B< B3038_D & Z1004=="ESP_2004"
replace A2037_3 =1 if B3038_B> B3038_D & Z1004=="ESP_2004"
replace A2037_3 =0 if B3038_B == B3038_D & Z1004=="ESP_2004"
replace A2037_3 =0 if B3038_B ==. & Z1004=="ESP_2004"
replace A2037_3 =0 if B3038_D ==. & Z1004=="ESP_2004"
*list A2037_3 B3038_A B3038_B if Z1004=="ESP_2004"
*tab A2037_3 if Z1004=="ESP_2004"

replace A2037_4 =1 if B3038_C< B3038_B & Z1004=="ESP_2004"
replace A2037_4 =0 if B3038_C> B3038_B & Z1004=="ESP_2004"
replace A2037_4 =0 if B3038_C == B3038_B & Z1004=="ESP_2004" 
replace A2037_4 =0 if B3038_C ==. & Z1004=="ESP_2004"
replace A2037_4 =0 if B3038_B ==. & Z1004=="ESP_2004"
*list A2037_4 B3038_A B3038_C if Z1004=="ESP_2004" 
*tab A2037_4 if Z1004=="ESP_2004"

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4)/4 if Z1004=="ESP_2004"
*tab A2037  if Z1004=="ESP_2004"

*)correct placement of parties on the left-right is following the 
replace A2038_1 =0 if B3038_A>5 & Z1004=="ESP_2004"
replace A2038_1 =0 if B3038_A==5 & Z1004=="ESP_2004"
replace A2038_1 =1 if B3038_A<5  & Z1004=="ESP_2004"
replace A2038_1 =0 if B3038_A==.  & Z1004=="ESP_2004"
*tab A2038_1 if Z1004=="ESP_2004"

replace A2038_2 =1 if B3038_B>5 & Z1004=="ESP_2004"
replace A2038_2 =0 if B3038_B==5 & Z1004=="ESP_2004"
replace A2038_2 =0 if B3038_B<5  & Z1004=="ESP_2004"
replace A2038_2 =0 if B3038_B==.  & Z1004=="ESP_2004"
*list A2038_2 B3038_B if Z1004=="ESP_2004"
*tab A2038_2 if Z1004=="ESP_2004"

replace A2038_3 =1 if B3038_C<5 & Z1004=="ESP_2004"
replace A2038_3 =0 if B3038_C==5 & Z1004=="ESP_2004"
replace A2038_3 =0 if B3038_C>5  & Z1004=="ESP_2004"
replace A2038_3 =0 if B3038_C==.  & Z1004=="ESP_2004"
*tab A2038_3 if Z1004=="ESP_2004"
*list B3038_C A2038_3 if Z1004=="ESP_2004"

replace A2038_4 =0 if B3038_D<5 & Z1004=="ESP_2004"
replace A2038_4 =0 if B3038_D==5 & Z1004=="ESP_2004"
replace A2038_4 =1 if B3038_D>5  & Z1004=="ESP_2004"
replace A2038_4 =0 if B3038_D==.  & Z1004=="ESP_2004"
*list B3038_D A2038_4 if Z1004=="ESP_2004"
*tab A2038_4 if Z1004=="ESP_2004"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4)/4 if Z1004=="ESP_2004"
*tab A2038 if Z1004=="ESP_2004"

**version iii
**Party A
replace A2039_1 = B5018_A-B3038_A if Z1004=="ESP_2004"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="ESP_2004"
*tab  A2039_1 if Z1004=="ESP_2004"
***missings
sum B3038_A if Z1004=="ESP_2004"
replace A2039_1_b = B5018_A-B3038_A if Z1004=="ESP_2004"
replace A2039_1_b= B5018_A-(3.3+1.56) if B3038_A==. & Z1004=="ESP_2004"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="ESP_2004"
*tab  A2039_1_b if Z1004=="ESP_2004"

**Party B
replace A2039_2 = B5018_B-B3038_B if Z1004=="ESP_2004"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="ESP_2004"
*tab  A2039_2 if Z1004=="ESP_2004"
***missings
sum B3038_B if Z1004=="ESP_2004"
replace A2039_2_b = B5018_B-B3038_B if Z1004=="ESP_2004"
replace A2039_2_b= B5018_B-(7.82+1.9) if B3038_B==. & Z1004=="ESP_2004"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="ESP_2004"
*tab  A2039_2_b if Z1004=="ESP_2004"

**Party C
replace A2039_3 = B5018_C-B3038_C if Z1004=="ESP_2004"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="ESP_2004"
*tab  A2039_3 if Z1004=="ESP_2004"
***missings
sum B3038_C if Z1004=="ESP_2004"
replace A2039_3_b = B5018_C-B3038_C if Z1004=="ESP_2004"
replace A2039_3_b= B5018_C-(1.86+1.51) if B3038_C==. & Z1004=="ESP_2004"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="ESP_2004"
*tab  A2039_3_b if Z1004=="ESP_2004"

**Party D
replace A2039_4 = B5018_D-B3038_D if Z1004=="ESP_2004"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="ESP_2004"
*tab  A2039_4 if Z1004=="ESP_2004"
***missings
sum B3038_D if Z1004=="ESP_2004"
replace A2039_4_b = B5018_D-B3038_D if Z1004=="ESP_2004"
replace A2039_4_b= B5018_D-(4.61+2.3) if B3038_D==. & Z1004=="ESP_2004"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="ESP_2004"
*tab  A2039_4_b if Z1004=="ESP_2004"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4)/4 if Z1004=="ESP_2004"
sum  A2039 if Z1004=="ESP_2004"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b)/4 if Z1004=="ESP_2004"
sum  A2039_B if Z1004=="ESP_2004"

****************************************************************************************
*FRA_2007
sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="FRA_2007" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="FRA_2007" 

*tab C3011_A if Z1004=="FRA_2007", mis
*tab C3011_B if Z1004=="FRA_2007", mis
*tab C3011_C if Z1004=="FRA_2007", mis
*tab C3011_D if Z1004=="FRA_2007", mis
*tab C3011_E if Z1004=="FRA_2007", mis
*tab C3011_F if Z1004=="FRA_2007", mis
*tab C3011_G if Z1004=="FRA_2007", mis
*tab C3011_H if Z1004=="FRA_2007", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="FRA_2007"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="FRA_2007"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="FRA_2007"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="FRA_2007"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="FRA_2007"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="FRA_2007"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="FRA_2007"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="FRA_2007"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="FRA_2007"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*7 parties 
** gefbcad
replace A2037_1 =0 if C3011_E< C3011_G & Z1004=="FRA_2007"
replace A2037_1 =1 if C3011_E> C3011_G & Z1004=="FRA_2007"
replace A2037_1 =0 if C3011_E == C3011_G & Z1004=="FRA_2007"
replace A2037_1 =0 if C3011_E ==. & Z1004=="FRA_2007"
replace A2037_1 =0 if C3011_G ==. & Z1004=="FRA_2007"
*list A2037_1 C3011_E C3011_F if Z1004=="FRA_2007"
*tab A2037_1 if Z1004=="FRA_2007", miss

replace A2037_2 =0 if C3011_F< C3011_E & Z1004=="FRA_2007"
replace A2037_2 =1 if C3011_F> C3011_E & Z1004=="FRA_2007"
replace A2037_2 =0 if C3011_F == C3011_E & Z1004=="FRA_2007"
replace A2037_2 =0 if C3011_F ==. & Z1004=="FRA_2007"
replace A2037_2 =0 if C3011_E ==. & Z1004=="FRA_2007"
*list A2037_2 C3011_F C3011_B if Z1004=="FRA_2007"
*tab A2037_2 if Z1004=="FRA_2007", miss

replace A2037_3 =0 if C3011_B< C3011_F & Z1004=="FRA_2007"
replace A2037_3 =1 if C3011_B> C3011_F & Z1004=="FRA_2007"
replace A2037_3 =0 if C3011_B == C3011_F & Z1004=="FRA_2007"
replace A2037_3 =0 if C3011_B ==. & Z1004=="FRA_2007"
replace A2037_3 =0 if C3011_F ==. & Z1004=="FRA_2007"
*list A2037_3 C3011_B C3011_F if Z1004=="FRA_2007"
*tab A2037_3 if Z1004=="FRA_2007", miss

replace A2037_4 =1 if C3011_B< C3011_C & Z1004=="FRA_2007"
replace A2037_4 =0 if C3011_B> C3011_C & Z1004=="FRA_2007"
replace A2037_4 =0 if C3011_B == C3011_C & Z1004=="FRA_2007"
replace A2037_4 =0 if C3011_B ==. & Z1004=="FRA_2007"
replace A2037_4 =0 if C3011_C ==. & Z1004=="FRA_2007"
*list A2037_4 C3011_C C3011_H if Z1004=="FRA_2007"
*tab A2037_4 if Z1004=="FRA_2007"

replace A2037_5 =1 if C3011_C< C3011_A & Z1004=="FRA_2007"
replace A2037_5 =0 if C3011_C> C3011_A & Z1004=="FRA_2007"
replace A2037_5 =0 if C3011_C == C3011_A & Z1004=="FRA_2007"
replace A2037_5 =0 if C3011_C ==. & Z1004=="FRA_2007"
replace A2037_5 =0 if C3011_A ==. & Z1004=="FRA_2007"
*list A2037_5 C3011_D C3011_H if Z1004=="FRA_2007"
*tab A2037_5 if Z1004=="FRA_2007", miss

replace A2037_6 =0 if C3011_D< C3011_A & Z1004=="FRA_2007"
replace A2037_6 =1 if C3011_D> C3011_A & Z1004=="FRA_2007"
replace A2037_6 =0 if C3011_D == C3011_A & Z1004=="FRA_2007"
replace A2037_6 =0 if C3011_D ==. & Z1004=="FRA_2007"
replace A2037_6 =0 if C3011_A ==. & Z1004=="FRA_2007"
*list A2037_6 C3011_D C3011_A if Z1004=="FRA_2007"
*tab A2037_6 if Z1004=="FRA_2007", miss

replace A2037_7 =1 if C3011_G< C3011_D & Z1004=="FRA_2007"
replace A2037_7 =0 if C3011_G> C3011_D & Z1004=="FRA_2007"
replace A2037_7 =0 if C3011_G == C3011_D & Z1004=="FRA_2007"
replace A2037_7 =0 if C3011_G ==. & Z1004=="FRA_2007"
replace A2037_7 =0 if C3011_D ==. & Z1004=="FRA_2007"
*list A2037_7 C3011_F C3011_G if Z1004=="FRA_2007"
*tab A2037_7 if Z1004=="FRA_2007", miss

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7)/7 if Z1004=="FRA_2007"
*tab A2037 if Z1004=="FRA_2007"

*ii)correct placement of parties on the left-right is following the 
*7 parties
replace A2038_1 =0 if C3011_A<5 & Z1004=="FRA_2007"
replace A2038_1 =0 if C3011_A==5 & Z1004=="FRA_2007"
replace A2038_1 =1 if C3011_A>5  & Z1004=="FRA_2007"
replace A2038_1 =0 if C3011_A==.  & Z1004=="FRA_2007"
*tab A2038_1 if Z1004=="FRA_2007"

replace A2038_2 =0 if C3011_B>5 & Z1004=="FRA_2007"
replace A2038_2 =0 if C3011_B==5 & Z1004=="FRA_2007"
replace A2038_2 =1 if C3011_B<5  & Z1004=="FRA_2007"
replace A2038_2 =0 if C3011_B==.  & Z1004=="FRA_2007"
*list A2038_2 C3011_B if Z1004=="FRA_2007"
*tab A2038_2 if Z1004=="FRA_2007"

replace A2038_3 =0 if C3011_C>5 & Z1004=="FRA_2007"
replace A2038_3 =1 if C3011_C==5 & Z1004=="FRA_2007"
replace A2038_3 =0 if C3011_C<5  & Z1004=="FRA_2007"
replace A2038_3 =0 if C3011_C==.  & Z1004=="FRA_2007"
*tab A2038_3 if Z1004=="FRA_2007"
*list C3011_C A2038_3 if Z1004=="FRA_2007"

replace A2038_4 =0 if C3011_D<5 & Z1004=="FRA_2007"
replace A2038_4 =0 if C3011_D==5 & Z1004=="FRA_2007"
replace A2038_4 =1 if C3011_D>5  & Z1004=="FRA_2007"
replace A2038_4 =0 if C3011_D==.  & Z1004=="FRA_2007"
*list C3011_D A2038_4 if Z1004=="FRA_2007"
*tab A2038_4 if Z1004=="FRA_2007"

replace A2038_5 =1 if C3011_E<5 & Z1004=="FRA_2007"
replace A2038_5 =0 if C3011_E==5 & Z1004=="FRA_2007"
replace A2038_5 =0 if C3011_E>5  & Z1004=="FRA_2007"
replace A2038_5 =0 if C3011_E==.  & Z1004=="FRA_2007"
*list C3011_E A2038_4 if Z1004=="FRA_2007"
*tab A2038_5 if Z1004=="FRA_2007"

replace A2038_6 =0 if C3011_F>5 & Z1004=="FRA_2007"
replace A2038_6 =0 if C3011_F==5 & Z1004=="FRA_2007"
replace A2038_6 =1 if C3011_F<5  & Z1004=="FRA_2007"
replace A2038_6 =0 if C3011_F==.  & Z1004=="FRA_2007"
*list C3011_H A2038_5 if Z1004=="FRA_2007"
*tab A2038_6 if Z1004=="FRA_2007"

replace A2038_7 =1 if C3011_G<5 & Z1004=="FRA_2007"
replace A2038_7 =0 if C3011_G==5 & Z1004=="FRA_2007"
replace A2038_7 =0 if C3011_G>5  & Z1004=="FRA_2007"
replace A2038_7 =0 if C3011_G==.  & Z1004=="FRA_2007"
*list C3011_G A2038_7 if Z1004=="FRA_2007"
*tab A2038_7 if Z1004=="FRA_2007"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7)/7 if Z1004=="FRA_2007"
*tab A2038 if Z1004=="FRA_2007"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="FRA_2007"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="FRA_2007"
*tab  A2039_1 if Z1004=="FRA_2007"
***missings
sum C3011_A if Z1004=="FRA_2007"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="FRA_2007"
replace A2039_1_b= C5017_A-(7.99+1.87) if C3011_A==. & Z1004=="FRA_2007"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="FRA_2007"
*tab  A2039_1_b if Z1004=="FRA_2007"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="FRA_2007"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="FRA_2007"
*tab  A2039_2 if Z1004=="FRA_2007"
***missings
sum C3011_B if Z1004=="FRA_2007"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="FRA_2007"
replace A2039_2_b= C5017_B-(3.54+2.09) if C3011_B==. & Z1004=="FRA_2007"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="FRA_2007"
*tab  A2039_2_b if Z1004=="FRA_2007"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="FRA_2007"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="FRA_2007"
*tab  A2039_3 if Z1004=="FRA_2007"
***missings
sum C3011_C if Z1004=="FRA_2007"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="FRA_2007"
replace A2039_3_b= C5017_C-(5.84+1.88) if C3011_C==. & Z1004=="FRA_2007"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="FRA_2007"
*tab  A2039_3_b if Z1004=="FRA_2007"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="FRA_2007"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="FRA_2007"
*tab  A2039_4 if Z1004=="FRA_2007"
***missings
sum C3011_E if Z1004=="FRA_2007"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="FRA_2007"
replace A2039_4_b= C5017_E-(1.81+1.92) if C3011_E==. & Z1004=="FRA_2007"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="FRA_2007"
*tab  A2039_4_b if Z1004=="FRA_2007"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="FRA_2007"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="FRA_2007"
*tab  A2039_5 if Z1004=="FRA_2007"
***missings
sum C3011_D if Z1004=="FRA_2007"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="FRA_2007"
replace A2039_5_b= C5017_D-(8.13+3.1) if C3011_D==. & Z1004=="FRA_2007"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="FRA_2007"
*tab  A2039_5_b if Z1004=="FRA_2007"

*Party F
replace A2039_6 = C5017_F-C3011_F if Z1004=="FRA_2007"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="FRA_2007"
*tab  A2039_6 if Z1004=="FRA_2007"
***missings
sum C3011_F if Z1004=="FRA_2007"
replace A2039_6_b = C5017_F-C3011_F if Z1004=="FRA_2007"
replace A2039_6_b= C5017_F-(3.43+1.78) if C3011_F==. & Z1004=="FRA_2007"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="FRA_2007"
*tab  A2039_6_b if Z1004=="FRA_2007"

*Party G
replace A2039_7 = C5017_G-C3011_G if Z1004=="FRA_2007"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="FRA_2007"
*tab  A2039_7 if Z1004=="FRA_2007"
***missings
sum C3011_G if Z1004=="FRA_2007"
replace A2039_7_b = C5017_G-C3011_G if Z1004=="FRA_2007"
replace A2039_7_b= C5017_G-(1.14+1.86) if C3011_G==. & Z1004=="FRA_2007"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="FRA_2007"
*tab  A2039_7_b if Z1004=="FRA_2007"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7)/7 if Z1004=="FRA_2007"
sum A2039 if Z1004=="FRA_2007"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b)/7 if Z1004=="FRA_2007"
sum  A2039_B if Z1004=="FRA_2007"



****************************************************************************************
**DEU_2005
sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="DEU_2005" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="DEU_2005" 

*tab C3011_A if Z1004=="DEU_2005", mis
*tab C3011_B if Z1004=="DEU_2005", mis
*tab C3011_C if Z1004=="DEU_2005", mis
*tab C3011_D if Z1004=="DEU_2005", mis
*tab C3011_E if Z1004=="DEU_2005", mis
*tab C3011_F if Z1004=="DEU_2005", mis
*tab C3011_G if Z1004=="DEU_2005", mis
*tab C3011_H if Z1004=="DEU_2005", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2005"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2005"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2005"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2005"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2005"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2005"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2005"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2005"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2005"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*6 parties 
** DEACBF
replace A2037_1 =0 if C3011_E< C3011_D & Z1004=="DEU_2005"
replace A2037_1 =1 if C3011_E> C3011_D & Z1004=="DEU_2005"
replace A2037_1 =0 if C3011_E == C3011_D & Z1004=="DEU_2005"
replace A2037_1 =0 if C3011_E ==. & Z1004=="DEU_2005"
replace A2037_1 =0 if C3011_D ==. & Z1004=="DEU_2005"
*list A2037_1 C3011_E C3011_F if Z1004=="DEU_2005"
*tab A2037_1 if Z1004=="DEU_2005", miss

replace A2037_2 =0 if C3011_A< C3011_E & Z1004=="DEU_2005"
replace A2037_2 =1 if C3011_A> C3011_E & Z1004=="DEU_2005"
replace A2037_2 =0 if C3011_A == C3011_E & Z1004=="DEU_2005"
replace A2037_2 =0 if C3011_A ==. & Z1004=="DEU_2005"
replace A2037_2 =0 if C3011_E ==. & Z1004=="DEU_2005"
*list A2037_2 C3011_F C3011_B if Z1004=="DEU_2005"
*tab A2037_2 if Z1004=="DEU_2005", miss

replace A2037_3 =1 if C3011_A< C3011_C & Z1004=="DEU_2005"
replace A2037_3 =0 if C3011_A> C3011_C & Z1004=="DEU_2005"
replace A2037_3 =0 if C3011_A == C3011_C & Z1004=="DEU_2005"
replace A2037_3 =0 if C3011_A ==. & Z1004=="DEU_2005"
replace A2037_3 =0 if C3011_C ==. & Z1004=="DEU_2005"
*list A2037_3 C3011_B C3011_F if Z1004=="DEU_2005"
*tab A2037_3 if Z1004=="DEU_2005", miss

replace A2037_5 =1 if C3011_C< C3011_B & Z1004=="DEU_2005"
replace A2037_5 =0 if C3011_C> C3011_B & Z1004=="DEU_2005"
replace A2037_5 =0 if C3011_C == C3011_B & Z1004=="DEU_2005"
replace A2037_5 =0 if C3011_C ==. & Z1004=="DEU_2005"
replace A2037_5 =0 if C3011_B ==. & Z1004=="DEU_2005"
*list A2037_5 C3011_D C3011_H if Z1004=="DEU_2005"
*tab A2037_5 if Z1004=="DEU_2005", miss

replace A2037_6 =1 if C3011_B< C3011_F & Z1004=="DEU_2005"
replace A2037_6 =0 if C3011_B> C3011_F & Z1004=="DEU_2005"
replace A2037_6 =0 if C3011_B == C3011_F & Z1004=="DEU_2005"
replace A2037_6 =0 if C3011_B ==. & Z1004=="DEU_2005"
replace A2037_6 =0 if C3011_F ==. & Z1004=="DEU_2005"
*list A2037_6 C3011_D C3011_A if Z1004=="DEU_2005"
*tab A2037_6 if Z1004=="DEU_2005", miss

replace A2037_7 =1 if C3011_D< C3011_F & Z1004=="DEU_2005"
replace A2037_7 =0 if C3011_D> C3011_F & Z1004=="DEU_2005"
replace A2037_7 =0 if C3011_D == C3011_F & Z1004=="DEU_2005"
replace A2037_7 =0 if C3011_D ==. & Z1004=="DEU_2005"
replace A2037_7 =0 if C3011_F ==. & Z1004=="DEU_2005"
*list A2037_7 C3011_F C3011_G if Z1004=="DEU_2005"
*tab A2037_7 if Z1004=="DEU_2005", miss


***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_5+A2037_6+A2037_7)/6 if Z1004=="DEU_2005"
*tab A2037 if Z1004=="DEU_2005"

*ii)correct placement of parties on the left-right is following the 
*7 parties
replace A2038_1 =1 if C3011_A<5 & Z1004=="DEU_2005"
replace A2038_1 =0 if C3011_A==5 & Z1004=="DEU_2005"
replace A2038_1 =0 if C3011_A>5  & Z1004=="DEU_2005"
replace A2038_1 =0 if C3011_A==.  & Z1004=="DEU_2005"
*tab A2038_1 if Z1004=="DEU_2005"

replace A2038_2 =1 if C3011_B>5 & Z1004=="DEU_2005"
replace A2038_2 =0 if C3011_B==5 & Z1004=="DEU_2005"
replace A2038_2 =0 if C3011_B<5  & Z1004=="DEU_2005"
replace A2038_2 =0 if C3011_B==.  & Z1004=="DEU_2005"
*list A2038_2 C3011_B if Z1004=="DEU_2005"
*tab A2038_2 if Z1004=="DEU_2005"

replace A2038_3 =1 if C3011_C>5 & Z1004=="DEU_2005"
replace A2038_3 =0 if C3011_C==5 & Z1004=="DEU_2005"
replace A2038_3 =0 if C3011_C<5  & Z1004=="DEU_2005"
replace A2038_3 =0 if C3011_C==.  & Z1004=="DEU_2005"
*tab A2038_3 if Z1004=="DEU_2005"
*list C3011_C A2038_3 if Z1004=="DEU_2005"

replace A2038_4 =1 if C3011_D<5 & Z1004=="DEU_2005"
replace A2038_4 =0 if C3011_D==5 & Z1004=="DEU_2005"
replace A2038_4 =0 if C3011_D>5  & Z1004=="DEU_2005"
replace A2038_4 =0 if C3011_D==.  & Z1004=="DEU_2005"
*list C3011_D A2038_4 if Z1004=="DEU_2005"
*tab A2038_4 if Z1004=="DEU_2005"

replace A2038_5 =1 if C3011_E<5 & Z1004=="DEU_2005"
replace A2038_5 =0 if C3011_E==5 & Z1004=="DEU_2005"
replace A2038_5 =0 if C3011_E>5  & Z1004=="DEU_2005"
replace A2038_5 =0 if C3011_E==.  & Z1004=="DEU_2005"
*list C3011_E A2038_4 if Z1004=="DEU_2005"
*tab A2038_5 if Z1004=="DEU_2005"

replace A2038_6 =1 if C3011_F>5 & Z1004=="DEU_2005"
replace A2038_6 =0 if C3011_F==5 & Z1004=="DEU_2005"
replace A2038_6 =0 if C3011_F<5  & Z1004=="DEU_2005"
replace A2038_6 =0 if C3011_F==.  & Z1004=="DEU_2005"
*list C3011_H A2038_5 if Z1004=="DEU_2005"
*tab A2038_6 if Z1004=="DEU_2005"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="DEU_2005"
*tab A2038 if Z1004=="DEU_2005"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="DEU_2005"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="DEU_2005"
*tab  A2039_1 if Z1004=="DEU_2005"
***missings
sum C3011_A if Z1004=="DEU_2005"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="DEU_2005"
replace A2039_1_b= C5017_A-(3.6+2.1) if C3011_A==. & Z1004=="DEU_2005"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="DEU_2005"
*tab  A2039_1_b if Z1004=="DEU_2005"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="DEU_2005"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="DEU_2005"
*tab  A2039_2 if Z1004=="DEU_2005"
***missings
sum C3011_B if Z1004=="DEU_2005"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="DEU_2005"
replace A2039_2_b= C5017_B-(6.08+2.13) if C3011_B==. & Z1004=="DEU_2005"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="DEU_2005"
*tab  A2039_2_b if Z1004=="DEU_2005"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="DEU_2005"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="DEU_2005"
*tab  A2039_3 if Z1004=="DEU_2005"
***missings
sum C3011_C if Z1004=="DEU_2005"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="DEU_2005"
replace A2039_3_b= C5017_C-(5.23+2.08) if C3011_C==. & Z1004=="DEU_2005"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="DEU_2005"
*tab  A2039_3_b if Z1004=="DEU_2005"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="DEU_2005"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="DEU_2005"
*tab  A2039_4 if Z1004=="DEU_2005"
***missings
sum C3011_E if Z1004=="DEU_2005"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="DEU_2005"
replace A2039_4_b= C5017_E-(3.34+2.03) if C3011_E==. & Z1004=="DEU_2005"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="DEU_2005"
*tab  A2039_4_b if Z1004=="DEU_2005"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="DEU_2005"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="DEU_2005"
*tab  A2039_5 if Z1004=="DEU_2005"
***missings
sum C3011_D if Z1004=="DEU_2005"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="DEU_2005"
replace A2039_5_b= C5017_D-(1.23+2.14) if C3011_D==. & Z1004=="DEU_2005"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="DEU_2005"
*tab  A2039_5_b if Z1004=="DEU_2005"

*Party F
replace A2039_6 = C5017_F-C3011_F if Z1004=="DEU_2005"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="DEU_2005"
*tab  A2039_6 if Z1004=="DEU_2005"
***missings
sum C3011_F if Z1004=="DEU_2005"
replace A2039_6_b = C5017_F-C3011_F if Z1004=="DEU_2005"
replace A2039_6_b= C5017_F-(6.54+2.31) if C3011_F==. & Z1004=="DEU_2005"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="DEU_2005"
*tab  A2039_6_b if Z1004=="DEU_2005"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6)/6 if Z1004=="DEU_2005"
sum A2039 if Z1004=="DEU_2005"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b)/6 if Z1004=="DEU_2005"
sum  A2039_B if Z1004=="DEU_2005"
****************************************************************************************

**DEU_2009

sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="DEU_2009" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="DEU_2009" 

*tab C3011_A if Z1004=="DEU_2009", mis
*tab C3011_B if Z1004=="DEU_2009", mis
*tab C3011_C if Z1004=="DEU_2009", mis
*tab C3011_D if Z1004=="DEU_2009", mis
*tab C3011_E if Z1004=="DEU_2009", mis
*tab C3011_F if Z1004=="DEU_2009", mis
*tab C3011_G if Z1004=="DEU_2009", mis
*tab C3011_H if Z1004=="DEU_2009", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2009"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2009"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2009"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2009"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2009"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2009"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2009"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2009"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="DEU_2009"

***RECODES
replace C5017_A=6 if Z1004=="DEU_2009" 
replace C5017_B=4 if Z1004=="DEU_2009" 
replace C5017_C=6 if Z1004=="DEU_2009" 
replace C5017_D=1 if Z1004=="DEU_2009" 
replace C5017_E=3 if Z1004=="DEU_2009" 
replace C5017_F=7 if Z1004=="DEU_2009" 

**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*6 parties 
** DEBCAF
replace A2037_1 =0 if C3011_E< C3011_D & Z1004=="DEU_2009"
replace A2037_1 =1 if C3011_E> C3011_D & Z1004=="DEU_2009"
replace A2037_1 =0 if C3011_E == C3011_D & Z1004=="DEU_2009"
replace A2037_1 =0 if C3011_E ==. & Z1004=="DEU_2009"
replace A2037_1 =0 if C3011_D ==. & Z1004=="DEU_2009"
*list A2037_1 C3011_E C3011_F if Z1004=="DEU_2009"
*tab A2037_1 if Z1004=="DEU_2009", miss

replace A2037_2 =0 if C3011_B< C3011_E & Z1004=="DEU_2009"
replace A2037_2 =1 if C3011_B> C3011_E & Z1004=="DEU_2009"
replace A2037_2 =0 if C3011_B == C3011_E & Z1004=="DEU_2009"
replace A2037_2 =0 if C3011_B ==. & Z1004=="DEU_2009"
replace A2037_2 =0 if C3011_E ==. & Z1004=="DEU_2009"
*list A2037_2 C3011_F C3011_B if Z1004=="DEU_2009"
*tab A2037_2 if Z1004=="DEU_2009", miss

replace A2037_3 =1 if C3011_B< C3011_C & Z1004=="DEU_2009"
replace A2037_3 =0 if C3011_B> C3011_C & Z1004=="DEU_2009"
replace A2037_3 =0 if C3011_B == C3011_C & Z1004=="DEU_2009"
replace A2037_3 =0 if C3011_B ==. & Z1004=="DEU_2009"
replace A2037_3 =0 if C3011_C ==. & Z1004=="DEU_2009"
*list A2037_3 C3011_B C3011_F if Z1004=="DEU_2009"
*tab A2037_3 if Z1004=="DEU_2009", miss

replace A2037_4 =0 if C3011_A< C3011_C & Z1004=="DEU_2009"
replace A2037_4 =0 if C3011_A> C3011_C & Z1004=="DEU_2009"
replace A2037_4 =1 if C3011_A == C3011_C & Z1004=="DEU_2009"
replace A2037_4 =0 if C3011_A ==. & Z1004=="DEU_2009"
replace A2037_4 =0 if C3011_C ==. & Z1004=="DEU_2009"
*list A2037_4 C3011_C C3011_H if Z1004=="DEU_2009"
*tab A2037_4 if Z1004=="DEU_2009"

replace A2037_5 =1 if C3011_A< C3011_F & Z1004=="DEU_2009"
replace A2037_5 =0 if C3011_A> C3011_F & Z1004=="DEU_2009"
replace A2037_5 =0 if C3011_A == C3011_F & Z1004=="DEU_2009"
replace A2037_5 =0 if C3011_A ==. & Z1004=="DEU_2009"
replace A2037_5 =0 if C3011_F ==. & Z1004=="DEU_2009"
*list A2037_5 C3011_D C3011_H if Z1004=="DEU_2009"
*tab A2037_5 if Z1004=="DEU_2009", miss

replace A2037_6 =1 if C3011_D< C3011_F & Z1004=="DEU_2009"
replace A2037_6 =0 if C3011_D> C3011_F & Z1004=="DEU_2009"
replace A2037_6 =0 if C3011_D == C3011_F & Z1004=="DEU_2009"
replace A2037_6 =0 if C3011_D ==. & Z1004=="DEU_2009"
replace A2037_6 =0 if C3011_F ==. & Z1004=="DEU_2009"
*list A2037_6 C3011_D C3011_A if Z1004=="DEU_2009"
*tab A2037_6 if Z1004=="DEU_2009", miss

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_5+A2037_6+A2037_4)/6 if Z1004=="DEU_2009"
*tab A2037 if Z1004=="DEU_2009"

*ii)correct placement of parties on the left-right is following the 
*7 parties
replace A2038_1 =0 if C3011_A<5 & Z1004=="DEU_2009"
replace A2038_1 =0 if C3011_A==5 & Z1004=="DEU_2009"
replace A2038_1 =1 if C3011_A>5  & Z1004=="DEU_2009"
replace A2038_1 =0 if C3011_A==.  & Z1004=="DEU_2009"
*tab A2038_1 if Z1004=="DEU_2009"

replace A2038_2 =0 if C3011_B>5 & Z1004=="DEU_2009"
replace A2038_2 =0 if C3011_B==5 & Z1004=="DEU_2009"
replace A2038_2 =1 if C3011_B<5  & Z1004=="DEU_2009"
replace A2038_2 =0 if C3011_B==.  & Z1004=="DEU_2009"
*list A2038_2 C3011_B if Z1004=="DEU_2009"
*tab A2038_2 if Z1004=="DEU_2009"

replace A2038_3 =1 if C3011_C>5 & Z1004=="DEU_2009"
replace A2038_3 =0 if C3011_C==5 & Z1004=="DEU_2009"
replace A2038_3 =0 if C3011_C<5  & Z1004=="DEU_2009"
replace A2038_3 =0 if C3011_C==.  & Z1004=="DEU_2009"
*tab A2038_3 if Z1004=="DEU_2009"
*list C3011_C A2038_3 if Z1004=="DEU_2009"

replace A2038_4 =1 if C3011_D<5 & Z1004=="DEU_2009"
replace A2038_4 =0 if C3011_D==5 & Z1004=="DEU_2009"
replace A2038_4 =0 if C3011_D>5  & Z1004=="DEU_2009"
replace A2038_4 =0 if C3011_D==.  & Z1004=="DEU_2009"
*list C3011_D A2038_4 if Z1004=="DEU_2009"
*tab A2038_4 if Z1004=="DEU_2009"

replace A2038_5 =1 if C3011_E<5 & Z1004=="DEU_2009"
replace A2038_5 =0 if C3011_E==5 & Z1004=="DEU_2009"
replace A2038_5 =0 if C3011_E>5  & Z1004=="DEU_2009"
replace A2038_5 =0 if C3011_E==.  & Z1004=="DEU_2009"
*list C3011_E A2038_4 if Z1004=="DEU_2009"
*tab A2038_5 if Z1004=="DEU_2009"

replace A2038_6 =1 if C3011_F>5 & Z1004=="DEU_2009"
replace A2038_6 =0 if C3011_F==5 & Z1004=="DEU_2009"
replace A2038_6 =0 if C3011_F<5  & Z1004=="DEU_2009"
replace A2038_6 =0 if C3011_F==.  & Z1004=="DEU_2009"
*list C3011_H A2038_5 if Z1004=="DEU_2009"
*tab A2038_6 if Z1004=="DEU_2009"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="DEU_2009"
*tab A2038 if Z1004=="DEU_2009"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="DEU_2009"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="DEU_2009"
*tab  A2039_1 if Z1004=="DEU_2009"
***missings
sum C3011_A if Z1004=="DEU_2009"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="DEU_2009"
replace A2039_1_b= C5017_A-(6.43+1.6) if C3011_A==. & Z1004=="DEU_2009"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="DEU_2009"
*tab  A2039_1_b if Z1004=="DEU_2009"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="DEU_2009"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="DEU_2009"
*tab  A2039_2 if Z1004=="DEU_2009"
***missings
sum C3011_B if Z1004=="DEU_2009"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="DEU_2009"
replace A2039_2_b= C5017_B-(3.66+1.38) if C3011_B==. & Z1004=="DEU_2009"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="DEU_2009"
*tab  A2039_2_b if Z1004=="DEU_2009"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="DEU_2009"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="DEU_2009"
*tab  A2039_3 if Z1004=="DEU_2009"
***missings
sum C3011_C if Z1004=="DEU_2009"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="DEU_2009"
replace A2039_3_b= C5017_C-(5.81+1.63) if C3011_C==. & Z1004=="DEU_2009"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="DEU_2009"
*tab  A2039_3_b if Z1004=="DEU_2009"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="DEU_2009"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="DEU_2009"
*tab  A2039_4 if Z1004=="DEU_2009"
***missings
sum C3011_E if Z1004=="DEU_2009"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="DEU_2009"
replace A2039_4_b= C5017_E-(3.28+1.46) if C3011_E==. & Z1004=="DEU_2009"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="DEU_2009"
*tab  A2039_4_b if Z1004=="DEU_2009"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="DEU_2009"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="DEU_2009"
*tab  A2039_5 if Z1004=="DEU_2009"
***missings
sum C3011_D if Z1004=="DEU_2009"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="DEU_2009"
replace A2039_5_b= C5017_D-(1.12+1.31) if C3011_D==. & Z1004=="DEU_2009"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="DEU_2009"
*tab  A2039_5_b if Z1004=="DEU_2009"

*Party F
replace A2039_6 = C5017_F-C3011_F if Z1004=="DEU_2009"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="DEU_2009"
*tab  A2039_6 if Z1004=="DEU_2009"
***missings
sum C3011_F if Z1004=="DEU_2009"
replace A2039_6_b = C5017_F-C3011_F if Z1004=="DEU_2009"
replace A2039_6_b= C5017_F-(6.96+1.70) if C3011_F==. & Z1004=="DEU_2009"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="DEU_2009"
*tab  A2039_6_b if Z1004=="DEU_2009"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6)/6 if Z1004=="DEU_2009"
sum A2039 if Z1004=="DEU_2009"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b)/6 if Z1004=="DEU_2009"
sum  A2039_B if Z1004=="DEU_2009"

****************************************************************************************
sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="ISR_2006" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="ISR_2006" 

*tab C3011_A if Z1004=="ISR_2006", mis
*tab C3011_B if Z1004=="ISR_2006", mis
*tab C3011_C if Z1004=="ISR_2006", mis
*tab C3011_D if Z1004=="ISR_2006", mis
*tab C3011_E if Z1004=="ISR_2006", mis
*tab C3011_F if Z1004=="ISR_2006", mis
*tab C3011_G if Z1004=="ISR_2006", mis
*tab C3011_H if Z1004=="ISR_2006", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="ISR_2006"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="ISR_2006"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="ISR_2006"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="ISR_2006"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="ISR_2006"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="ISR_2006"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="ISR_2006"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="ISR_2006"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="ISR_2006"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*6 parties 
** BACDEF
replace A2037_1 =1 if C3011_B< C3011_A & Z1004=="ISR_2006"
replace A2037_1 =0 if C3011_B> C3011_A & Z1004=="ISR_2006"
replace A2037_1 =0 if C3011_B == C3011_A & Z1004=="ISR_2006"
replace A2037_1 =0 if C3011_B ==. & Z1004=="ISR_2006"
replace A2037_1 =0 if C3011_A ==. & Z1004=="ISR_2006"
*list A2037_1 C3011_E C3011_F if Z1004=="ISR_2006"
*tab A2037_1 if Z1004=="ISR_2006", miss

replace A2037_2 =1 if C3011_A< C3011_C & Z1004=="ISR_2006"
replace A2037_2 =0 if C3011_A> C3011_C & Z1004=="ISR_2006"
replace A2037_2 =0 if C3011_A == C3011_C & Z1004=="ISR_2006"
replace A2037_2 =0 if C3011_A ==. & Z1004=="ISR_2006"
replace A2037_2 =0 if C3011_A ==. & Z1004=="ISR_2006"
*list A2037_2 C3011_F C3011_B if Z1004=="ISR_2006"
*tab A2037_2 if Z1004=="ISR_2006", miss

replace A2037_3 =0 if C3011_D< C3011_C & Z1004=="ISR_2006"
replace A2037_3 =0 if C3011_D> C3011_C & Z1004=="ISR_2006"
replace A2037_3 =1 if C3011_D == C3011_C & Z1004=="ISR_2006"
replace A2037_3 =0 if C3011_D ==. & Z1004=="ISR_2006"
replace A2037_3 =0 if C3011_C ==. & Z1004=="ISR_2006"
*list A2037_3 C3011_B C3011_F if Z1004=="ISR_2006"
*tab A2037_3 if Z1004=="ISR_2006", miss

replace A2037_4 =1 if C3011_D< C3011_E & Z1004=="ISR_2006"
replace A2037_4 =0 if C3011_D> C3011_E & Z1004=="ISR_2006"
replace A2037_4 =0 if C3011_D == C3011_E & Z1004=="ISR_2006"
replace A2037_4 =0 if C3011_D ==. & Z1004=="ISR_2006"
replace A2037_4 =0 if C3011_E ==. & Z1004=="ISR_2006"
*list A2037_4 C3011_C C3011_H if Z1004=="ISR_2006"
*tab A2037_4 if Z1004=="ISR_2006"

replace A2037_5 =1 if C3011_E< C3011_F & Z1004=="ISR_2006"
replace A2037_5 =0 if C3011_E> C3011_F & Z1004=="ISR_2006"
replace A2037_5 =0 if C3011_E == C3011_F & Z1004=="ISR_2006"
replace A2037_5 =0 if C3011_E ==. & Z1004=="ISR_2006"
replace A2037_5 =0 if C3011_F ==. & Z1004=="ISR_2006"
*list A2037_5 C3011_D C3011_H if Z1004=="ISR_2006"
*tab A2037_5 if Z1004=="ISR_2006", miss

replace A2037_6 =1 if C3011_B< C3011_F & Z1004=="ISR_2006"
replace A2037_6 =0 if C3011_B> C3011_F & Z1004=="ISR_2006"
replace A2037_6 =0 if C3011_B == C3011_F & Z1004=="ISR_2006"
replace A2037_6 =0 if C3011_B ==. & Z1004=="ISR_2006"
replace A2037_6 =0 if C3011_F ==. & Z1004=="ISR_2006"
*list A2037_6 C3011_D C3011_A if Z1004=="ISR_2006"
*tab A2037_6 if Z1004=="ISR_2006", miss


***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_5+A2037_6+A2037_4)/6 if Z1004=="ISR_2006"
*tab A2037 if Z1004=="ISR_2006"

*ii)correct placement of parties on the left-right is following the 
*7 parties
replace A2038_1 =0 if C3011_A<5 & Z1004=="ISR_2006"
replace A2038_1 =1 if C3011_A==5 & Z1004=="ISR_2006"
replace A2038_1 =0 if C3011_A>5  & Z1004=="ISR_2006"
replace A2038_1 =0 if C3011_A==.  & Z1004=="ISR_2006"
*tab A2038_1 if Z1004=="ISR_2006"

replace A2038_2 =0 if C3011_B>5 & Z1004=="ISR_2006"
replace A2038_2 =0 if C3011_B==5 & Z1004=="ISR_2006"
replace A2038_2 =1 if C3011_B<5  & Z1004=="ISR_2006"
replace A2038_2 =0 if C3011_B==.  & Z1004=="ISR_2006"
*list A2038_2 C3011_B if Z1004=="ISR_2006"
*tab A2038_2 if Z1004=="ISR_2006"

replace A2038_3 =1 if C3011_C>5 & Z1004=="ISR_2006"
replace A2038_3 =0 if C3011_C==5 & Z1004=="ISR_2006"
replace A2038_3 =0 if C3011_C<5  & Z1004=="ISR_2006"
replace A2038_3 =0 if C3011_C==.  & Z1004=="ISR_2006"
*tab A2038_3 if Z1004=="ISR_2006"
*list C3011_C A2038_3 if Z1004=="ISR_2006"

replace A2038_4 =0 if C3011_D<5 & Z1004=="ISR_2006"
replace A2038_4 =0 if C3011_D==5 & Z1004=="ISR_2006"
replace A2038_4 =1 if C3011_D>5  & Z1004=="ISR_2006"
replace A2038_4 =0 if C3011_D==.  & Z1004=="ISR_2006"
*list C3011_D A2038_4 if Z1004=="ISR_2006"
*tab A2038_4 if Z1004=="ISR_2006"

replace A2038_5 =0 if C3011_E<5 & Z1004=="ISR_2006"
replace A2038_5 =0 if C3011_E==5 & Z1004=="ISR_2006"
replace A2038_5 =1 if C3011_E>5  & Z1004=="ISR_2006"
replace A2038_5 =0 if C3011_E==.  & Z1004=="ISR_2006"
*list C3011_E A2038_4 if Z1004=="ISR_2006"
*tab A2038_5 if Z1004=="ISR_2006"

replace A2038_6 =1 if C3011_F>5 & Z1004=="ISR_2006"
replace A2038_6 =0 if C3011_F==5 & Z1004=="ISR_2006"
replace A2038_6 =0 if C3011_F<5  & Z1004=="ISR_2006"
replace A2038_6 =0 if C3011_F==.  & Z1004=="ISR_2006"
*list C3011_H A2038_5 if Z1004=="ISR_2006"
*tab A2038_6 if Z1004=="ISR_2006"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="ISR_2006"
*tab A2038 if Z1004=="ISR_2006"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="ISR_2006"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="ISR_2006"
*tab  A2039_1 if Z1004=="ISR_2006"
***missings
sum C3011_A if Z1004=="ISR_2006"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="ISR_2006"
replace A2039_1_b= C5017_A-(5.16+2.6) if C3011_A==. & Z1004=="ISR_2006"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="ISR_2006"
*tab  A2039_1_b if Z1004=="ISR_2006"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="ISR_2006"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="ISR_2006"
*tab  A2039_2 if Z1004=="ISR_2006"
***missings
sum C3011_B if Z1004=="ISR_2006"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="ISR_2006"
replace A2039_2_b= C5017_B-(3.96+2.72) if C3011_B==. & Z1004=="ISR_2006"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="ISR_2006"
*tab  A2039_2_b if Z1004=="ISR_2006"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="ISR_2006"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="ISR_2006"
*tab  A2039_3 if Z1004=="ISR_2006"
***missings
sum C3011_C if Z1004=="ISR_2006"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="ISR_2006"
replace A2039_3_b= C5017_C-(6.03+2.79) if C3011_C==. & Z1004=="ISR_2006"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="ISR_2006"
*tab  A2039_3_b if Z1004=="ISR_2006"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="ISR_2006"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="ISR_2006"
*tab  A2039_4 if Z1004=="ISR_2006"
***missings
sum C3011_E if Z1004=="ISR_2006"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="ISR_2006"
replace A2039_4_b= C5017_E-(7.54+2.73) if C3011_E==. & Z1004=="ISR_2006"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="ISR_2006"
*tab  A2039_4_b if Z1004=="ISR_2006"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="ISR_2006"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="ISR_2006"
*tab  A2039_5 if Z1004=="ISR_2006"
***missings
sum C3011_D if Z1004=="ISR_2006"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="ISR_2006"
replace A2039_5_b= C5017_D-(6.84+2.62) if C3011_D==. & Z1004=="ISR_2006"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="ISR_2006"
*tab  A2039_5_b if Z1004=="ISR_2006"

*Party F
replace A2039_6 = C5017_F-C3011_F if Z1004=="ISR_2006"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="ISR_2006"
*tab  A2039_6 if Z1004=="ISR_2006"
***missings
sum C3011_F if Z1004=="ISR_2006"
replace A2039_6_b = C5017_F-C3011_F if Z1004=="ISR_2006"
replace A2039_6_b= C5017_F-(7.35+2.77) if C3011_F==. & Z1004=="ISR_2006"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="ISR_2006"
*tab  A2039_6_b if Z1004=="ISR_2006"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6)/6 if Z1004=="ISR_2006"
sum A2039 if Z1004=="ISR_2006"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b)/6 if Z1004=="ISR_2006"
sum  A2039_B if Z1004=="ISR_2006"

****************************************************************************************
sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="NLD_2006" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="NLD_2006" 

*tab C3011_A if Z1004=="NLD_2006", mis
*tab C3011_B if Z1004=="NLD_2006", mis
*tab C3011_C if Z1004=="NLD_2006", mis
*tab C3011_D if Z1004=="NLD_2006", mis
*tab C3011_E if Z1004=="NLD_2006", mis
*tab C3011_F if Z1004=="NLD_2006", mis
*tab C3011_G if Z1004=="NLD_2006", mis
*tab C3011_H if Z1004=="NLD_2006", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2006"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2006"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2006"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2006"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2006"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2006"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2006"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2006"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2006"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*8 parties 
** CFBGHADE
replace A2037_1 =1 if C3011_C< C3011_B & Z1004=="NLD_2006"
replace A2037_1 =0 if C3011_C> C3011_B & Z1004=="NLD_2006"
replace A2037_1 =0 if C3011_C == C3011_B & Z1004=="NLD_2006"
replace A2037_1 =0 if C3011_C ==. & Z1004=="NLD_2006"
replace A2037_1 =0 if C3011_B ==. & Z1004=="NLD_2006"
*list A2037_1 C3011_E C3011_F if Z1004=="NLD_2006"
*tab A2037_1 if Z1004=="NLD_2006", miss

replace A2037_2 =0 if C3011_B< C3011_F & Z1004=="NLD_2006"
replace A2037_2 =0 if C3011_B> C3011_F & Z1004=="NLD_2006"
replace A2037_2 =1 if C3011_B == C3011_F & Z1004=="NLD_2006"
replace A2037_2 =0 if C3011_B ==. & Z1004=="NLD_2006"
replace A2037_2 =0 if C3011_F ==. & Z1004=="NLD_2006"
*list A2037_2 C3011_F C3011_B if Z1004=="NLD_2006"
*tab A2037_2 if Z1004=="NLD_2006", miss

replace A2037_3 =1 if C3011_B< C3011_G & Z1004=="NLD_2006"
replace A2037_3 =0 if C3011_B> C3011_G & Z1004=="NLD_2006"
replace A2037_3 =0 if C3011_B == C3011_G & Z1004=="NLD_2006"
replace A2037_3 =0 if C3011_B ==. & Z1004=="NLD_2006"
replace A2037_3 =0 if C3011_G ==. & Z1004=="NLD_2006"
*list A2037_3 C3011_B C3011_F if Z1004=="NLD_2006"
*tab A2037_3 if Z1004=="NLD_2006", miss

replace A2037_4 =0 if C3011_G< C3011_H & Z1004=="NLD_2006"
replace A2037_4 =0 if C3011_G> C3011_H & Z1004=="NLD_2006"
replace A2037_4 =1 if C3011_G == C3011_H & Z1004=="NLD_2006"
replace A2037_4 =0 if C3011_G ==. & Z1004=="NLD_2006"
replace A2037_4 =0 if C3011_H ==. & Z1004=="NLD_2006"
*list A2037_4 C3011_C C3011_H if Z1004=="NLD_2006"
*tab A2037_4 if Z1004=="NLD_2006"

replace A2037_5 =1 if C3011_H< C3011_A & Z1004=="NLD_2006"
replace A2037_5 =0 if C3011_H> C3011_A & Z1004=="NLD_2006"
replace A2037_5 =0 if C3011_H == C3011_A & Z1004=="NLD_2006"
replace A2037_5 =0 if C3011_H ==. & Z1004=="NLD_2006"
replace A2037_5 =0 if C3011_A ==. & Z1004=="NLD_2006"
*list A2037_5 C3011_D C3011_H if Z1004=="NLD_2006"
*tab A2037_5 if Z1004=="NLD_2006", miss

replace A2037_6 =0 if C3011_A< C3011_E & Z1004=="NLD_2006"
replace A2037_6 =0 if C3011_A> C3011_E & Z1004=="NLD_2006"
replace A2037_6 =1 if C3011_A == C3011_E & Z1004=="NLD_2006"
replace A2037_6 =0 if C3011_A ==. & Z1004=="NLD_2006"
replace A2037_6 =0 if C3011_E ==. & Z1004=="NLD_2006"
*list A2037_6 C3011_D C3011_A if Z1004=="NLD_2006"
*tab A2037_6 if Z1004=="NLD_2006", miss

replace A2037_7 =0 if C3011_D< C3011_E & Z1004=="NLD_2006"
replace A2037_7 =1 if C3011_D> C3011_E & Z1004=="NLD_2006"
replace A2037_7 =0 if C3011_D == C3011_E & Z1004=="NLD_2006"
replace A2037_7 =0 if C3011_D ==. & Z1004=="NLD_2006"
replace A2037_7 =0 if C3011_E ==. & Z1004=="NLD_2006"
*list A2037_7 C3011_F C3011_G if Z1004=="NLD_2006"
*tab A2037_7 if Z1004=="NLD_2006", miss

replace A2037_8 =1 if C3011_C< C3011_D & Z1004=="NLD_2006"
replace A2037_8 =0 if C3011_C> C3011_D & Z1004=="NLD_2006"
replace A2037_8 =0 if C3011_C == C3011_D & Z1004=="NLD_2006"
replace A2037_8 =0 if C3011_C ==. & Z1004=="NLD_2006"
replace A2037_8 =0 if C3011_D ==. & Z1004=="NLD_2006"
*list A2037_8 C3011_E C3011_G if Z1004=="NLD_2006"
*tab A2037_8 if Z1004=="NLD_2006", miss

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7+A2037_8)/8 if Z1004=="NLD_2006"
*tab A2037 if Z1004=="NLD_2006"

*ii)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =0 if C3011_A<5 & Z1004=="NLD_2006"
replace A2038_1 =0 if C3011_A==5 & Z1004=="NLD_2006"
replace A2038_1 =1 if C3011_A>5  & Z1004=="NLD_2006"
replace A2038_1 =0 if C3011_A==.  & Z1004=="NLD_2006"
*tab A2038_1 if Z1004=="NLD_2006"

replace A2038_2 =0 if C3011_B>5 & Z1004=="NLD_2006"
replace A2038_2 =0 if C3011_B==5 & Z1004=="NLD_2006"
replace A2038_2 =1 if C3011_B<5  & Z1004=="NLD_2006"
replace A2038_2 =0 if C3011_B==.  & Z1004=="NLD_2006"
*list A2038_2 C3011_B if Z1004=="NLD_2006"
*tab A2038_2 if Z1004=="NLD_2006"

replace A2038_3 =0 if C3011_C>5 & Z1004=="NLD_2006"
replace A2038_3 =0 if C3011_C==5 & Z1004=="NLD_2006"
replace A2038_3 =1 if C3011_C<5  & Z1004=="NLD_2006"
replace A2038_3 =0 if C3011_C==.  & Z1004=="NLD_2006"
*tab A2038_3 if Z1004=="NLD_2006"
*list C3011_C A2038_3 if Z1004=="NLD_2006"

replace A2038_4 =0 if C3011_D<5 & Z1004=="NLD_2006"
replace A2038_4 =0 if C3011_D==5 & Z1004=="NLD_2006"
replace A2038_4 =1 if C3011_D>5  & Z1004=="NLD_2006"
replace A2038_4 =0 if C3011_D==.  & Z1004=="NLD_2006"
*list C3011_D A2038_4 if Z1004=="NLD_2006"
*tab A2038_4 if Z1004=="NLD_2006"

replace A2038_5 =0 if C3011_E<5 & Z1004=="NLD_2006"
replace A2038_5 =0 if C3011_E==5 & Z1004=="NLD_2006"
replace A2038_5 =1 if C3011_E>5  & Z1004=="NLD_2006"
replace A2038_5 =0 if C3011_E==.  & Z1004=="NLD_2006"
*list C3011_E A2038_4 if Z1004=="NLD_2006"
*tab A2038_5 if Z1004=="NLD_2006"

replace A2038_6 =0 if C3011_F>5 & Z1004=="NLD_2006"
replace A2038_6 =0 if C3011_F==5 & Z1004=="NLD_2006"
replace A2038_6 =1 if C3011_F<5  & Z1004=="NLD_2006"
replace A2038_6 =0 if C3011_F==.  & Z1004=="NLD_2006"
*list C3011_H A2038_5 if Z1004=="NLD_2006"
*tab A2038_6 if Z1004=="NLD_2006"

replace A2038_7 =0 if C3011_G<5 & Z1004=="NLD_2006"
replace A2038_7 =1 if C3011_G==5 & Z1004=="NLD_2006"
replace A2038_7 =0 if C3011_G>5  & Z1004=="NLD_2006"
replace A2038_7 =0 if C3011_G==.  & Z1004=="NLD_2006"
*list C3011_G A2038_7 if Z1004=="NLD_2006"
*tab A2038_7 if Z1004=="NLD_2006"

replace A2038_8 =0 if C3011_H<5 & Z1004=="NLD_2006"
replace A2038_8 =1 if C3011_H==5 & Z1004=="NLD_2006"
replace A2038_8 =0 if C3011_H>5  & Z1004=="NLD_2006"
replace A2038_8 =0 if C3011_H==.  & Z1004=="NLD_2006"
*list C3011_H A2038_8 if Z1004=="NLD_2006"
*tab A2038_8 if Z1004=="NLD_2006"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7+A2038_8)/8 if Z1004=="NLD_2006"
*tab A2038 if Z1004=="NLD_2006"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="NLD_2006"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="NLD_2006"
*tab  A2039_1 if Z1004=="NLD_2006"
***missings
sum C3011_A if Z1004=="NLD_2006"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="NLD_2006"
replace A2039_1_b= C5017_A-(6.75+1.72) if C3011_A==. & Z1004=="NLD_2006"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="NLD_2006"
*tab  A2039_1_b if Z1004=="NLD_2006"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="NLD_2006"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="NLD_2006"
*tab  A2039_2 if Z1004=="NLD_2006"
***missings
sum C3011_B if Z1004=="NLD_2006"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="NLD_2006"
replace A2039_2_b= C5017_B-(3.59+1.75) if C3011_B==. & Z1004=="NLD_2006"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="NLD_2006"
*tab  A2039_2_b if Z1004=="NLD_2006"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="NLD_2006"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="NLD_2006"
*tab  A2039_3 if Z1004=="NLD_2006"
***missings
sum C3011_C if Z1004=="NLD_2006"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="NLD_2006"
replace A2039_3_b= C5017_C-(2.63+1.98) if C3011_C==. & Z1004=="NLD_2006"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="NLD_2006"
*tab  A2039_3_b if Z1004=="NLD_2006"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="NLD_2006"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="NLD_2006"
*tab  A2039_4 if Z1004=="NLD_2006"
***missings
sum C3011_E if Z1004=="NLD_2006"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="NLD_2006"
replace A2039_4_b= C5017_E-(7.54+2.77) if C3011_E==. & Z1004=="NLD_2006"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="NLD_2006"
*tab  A2039_4_b if Z1004=="NLD_2006"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="NLD_2006"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="NLD_2006"
*tab  A2039_5 if Z1004=="NLD_2006"
***missings
sum C3011_D if Z1004=="NLD_2006"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="NLD_2006"
replace A2039_5_b= C5017_D-(7.19+1.72) if C3011_D==. & Z1004=="NLD_2006"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="NLD_2006"
*tab  A2039_5_b if Z1004=="NLD_2006"

*Party F
replace A2039_6 = C5017_F-C3011_F if Z1004=="NLD_2006"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="NLD_2006"
*tab  A2039_6 if Z1004=="NLD_2006"
***missings
sum C3011_F if Z1004=="NLD_2006"
replace A2039_6_b = C5017_F-C3011_F if Z1004=="NLD_2006"
replace A2039_6_b= C5017_F-(2.74+1.61) if C3011_F==. & Z1004=="NLD_2006"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="NLD_2006"
*tab  A2039_6_b if Z1004=="NLD_2006"

*Party G
replace A2039_7 = C5017_G-C3011_G if Z1004=="NLD_2006"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="NLD_2006"
*tab  A2039_7 if Z1004=="NLD_2006"
***missings
sum C3011_G if Z1004=="NLD_2006"
replace A2039_7_b = C5017_G-C3011_G if Z1004=="NLD_2006"
replace A2039_7_b= C5017_G-(5.77+1.91) if C3011_G==. & Z1004=="NLD_2006"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="NLD_2006"
*tab  A2039_7_b if Z1004=="NLD_2006"

*Party H
replace A2039_8 = C5017_H-C3011_H if Z1004=="NLD_2006"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="NLD_2006"
*tab  A2039_8 if Z1004=="NLD_2006"
***missings
sum C3011_H if Z1004=="NLD_2006"
replace A2039_8_b = C5017_H-C3011_H if Z1004=="NLD_2006"
replace A2039_8_b= C5017_H-(4.88+1.42) if C3011_H==. & Z1004=="NLD_2006"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="NLD_2006"
*tab  A2039_8_b if Z1004=="NLD_2006"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7+A2039_8)/8 if Z1004=="NLD_2006"
sum A2039 if Z1004=="NLD_2006"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b+A2039_8_b)/8 if Z1004=="NLD_2006"
sum  A2039_B if Z1004=="NLD_2006"

****************************************************************************************
sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="NZL_2008" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="NZL_2008" 

*tab C3011_A if Z1004=="NZL_2008", mis
*tab C3011_B if Z1004=="NZL_2008", mis
*tab C3011_C if Z1004=="NZL_2008", mis
*tab C3011_D if Z1004=="NZL_2008", mis
*tab C3011_E if Z1004=="NZL_2008", mis
*tab C3011_F if Z1004=="NZL_2008", mis
*tab C3011_G if Z1004=="NZL_2008", mis
*tab C3011_H if Z1004=="NZL_2008", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2008"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2008"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2008"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2008"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2008"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2008"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2008"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2008"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2008"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*8 parties 
** CBGDFAHE
replace A2037_1 =1 if C3011_C< C3011_B & Z1004=="NZL_2008"
replace A2037_1 =0 if C3011_C> C3011_B & Z1004=="NZL_2008"
replace A2037_1 =0 if C3011_C == C3011_B & Z1004=="NZL_2008"
replace A2037_1 =0 if C3011_C ==. & Z1004=="NZL_2008"
replace A2037_1 =0 if C3011_B ==. & Z1004=="NZL_2008"
*list A2037_1 C3011_E C3011_F if Z1004=="NZL_2008"
*tab A2037_1 if Z1004=="NZL_2008", miss

replace A2037_2 =0 if C3011_B< C3011_G & Z1004=="NZL_2008"
replace A2037_2 =0 if C3011_B> C3011_G & Z1004=="NZL_2008"
replace A2037_2 =1 if C3011_B == C3011_G & Z1004=="NZL_2008"
replace A2037_2 =0 if C3011_B ==. & Z1004=="NZL_2008"
replace A2037_2 =0 if C3011_G ==. & Z1004=="NZL_2008"
*list A2037_2 C3011_F C3011_B if Z1004=="NZL_2008"
*tab A2037_2 if Z1004=="NZL_2008", miss

replace A2037_3 =1 if C3011_B< C3011_D & Z1004=="NZL_2008"
replace A2037_3 =0 if C3011_B> C3011_D & Z1004=="NZL_2008"
replace A2037_3 =0 if C3011_B == C3011_D & Z1004=="NZL_2008"
replace A2037_3 =0 if C3011_B ==. & Z1004=="NZL_2008"
replace A2037_3 =0 if C3011_D ==. & Z1004=="NZL_2008"
*list A2037_3 C3011_B C3011_F if Z1004=="NZL_2008"
*tab A2037_3 if Z1004=="NZL_2008", miss

replace A2037_4 =1 if C3011_D< C3011_A & Z1004=="NZL_2008"
replace A2037_4 =0 if C3011_D> C3011_A & Z1004=="NZL_2008"
replace A2037_4 =0 if C3011_F == C3011_A & Z1004=="NZL_2008"
replace A2037_4 =0 if C3011_F ==. & Z1004=="NZL_2008"
replace A2037_4 =0 if C3011_A ==. & Z1004=="NZL_2008"
*list A2037_4 C3011_C C3011_H if Z1004=="NZL_2008"
*tab A2037_4 if Z1004=="NZL_2008"

replace A2037_5 =0 if C3011_F< C3011_A & Z1004=="NZL_2008"
replace A2037_5 =0 if C3011_F> C3011_A & Z1004=="NZL_2008"
replace A2037_5 =1 if C3011_F == C3011_A & Z1004=="NZL_2008"
replace A2037_5 =0 if C3011_F ==. & Z1004=="NZL_2008"
replace A2037_5 =0 if C3011_A ==. & Z1004=="NZL_2008"
*list A2037_5 C3011_D C3011_H if Z1004=="NZL_2008"
*tab A2037_5 if Z1004=="NZL_2008", miss

replace A2037_6 =1 if C3011_A< C3011_H & Z1004=="NZL_2008"
replace A2037_6 =0 if C3011_A> C3011_H & Z1004=="NZL_2008"
replace A2037_6 =0 if C3011_A == C3011_H & Z1004=="NZL_2008"
replace A2037_6 =0 if C3011_A ==. & Z1004=="NZL_2008"
replace A2037_6 =0 if C3011_H ==. & Z1004=="NZL_2008"
*list A2037_6 C3011_D C3011_A if Z1004=="NZL_2008"
*tab A2037_6 if Z1004=="NZL_2008", miss

replace A2037_7 =1 if C3011_H< C3011_E & Z1004=="NZL_2008"
replace A2037_7 =0 if C3011_H> C3011_E & Z1004=="NZL_2008"
replace A2037_7 =0 if C3011_H == C3011_E & Z1004=="NZL_2008"
replace A2037_7 =0 if C3011_H ==. & Z1004=="NZL_2008"
replace A2037_7 =0 if C3011_E ==. & Z1004=="NZL_2008"
*list A2037_7 C3011_F C3011_G if Z1004=="NZL_2008"
*tab A2037_7 if Z1004=="NZL_2008", miss

replace A2037_8 =1 if C3011_C< C3011_E & Z1004=="NZL_2008"
replace A2037_8 =0 if C3011_C> C3011_E & Z1004=="NZL_2008"
replace A2037_8 =0 if C3011_C == C3011_E & Z1004=="NZL_2008"
replace A2037_8 =0 if C3011_C ==. & Z1004=="NZL_2008"
replace A2037_8 =0 if C3011_E ==. & Z1004=="NZL_2008"
*list A2037_8 C3011_E C3011_G if Z1004=="NZL_2008"
*tab A2037_8 if Z1004=="NZL_2008", miss

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7+A2037_8)/8 if Z1004=="NZL_2008"
*tab A2037 if Z1004=="NZL_2008"

*ii)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =0 if C3011_A<5 & Z1004=="NZL_2008"
replace A2038_1 =0 if C3011_A==5 & Z1004=="NZL_2008"
replace A2038_1 =1 if C3011_A>5  & Z1004=="NZL_2008"
replace A2038_1 =0 if C3011_A==.  & Z1004=="NZL_2008"
*tab A2038_1 if Z1004=="NZL_2008"

replace A2038_2 =0 if C3011_B>5 & Z1004=="NZL_2008"
replace A2038_2 =0 if C3011_B==5 & Z1004=="NZL_2008"
replace A2038_2 =1 if C3011_B<5  & Z1004=="NZL_2008"
replace A2038_2 =0 if C3011_B==.  & Z1004=="NZL_2008"
*list A2038_2 C3011_B if Z1004=="NZL_2008"
*tab A2038_2 if Z1004=="NZL_2008"

replace A2038_3 =0 if C3011_C>5 & Z1004=="NZL_2008"
replace A2038_3 =0 if C3011_C==5 & Z1004=="NZL_2008"
replace A2038_3 =1 if C3011_C<5  & Z1004=="NZL_2008"
replace A2038_3 =0 if C3011_C==.  & Z1004=="NZL_2008"
*tab A2038_3 if Z1004=="NZL_2008"
*list C3011_C A2038_3 if Z1004=="NZL_2008"

replace A2038_4 =0 if C3011_D<5 & Z1004=="NZL_2008"
replace A2038_4 =1 if C3011_D==5 & Z1004=="NZL_2008"
replace A2038_4 =0 if C3011_D>5  & Z1004=="NZL_2008"
replace A2038_4 =0 if C3011_D==.  & Z1004=="NZL_2008"
*list C3011_D A2038_4 if Z1004=="NZL_2008"
*tab A2038_4 if Z1004=="NZL_2008"

replace A2038_5 =0 if C3011_E<5 & Z1004=="NZL_2008"
replace A2038_5 =0 if C3011_E==5 & Z1004=="NZL_2008"
replace A2038_5 =1 if C3011_E>5  & Z1004=="NZL_2008"
replace A2038_5 =0 if C3011_E==.  & Z1004=="NZL_2008"
*list C3011_E A2038_4 if Z1004=="NZL_2008"
*tab A2038_5 if Z1004=="NZL_2008"

replace A2038_6 =1 if C3011_F>5 & Z1004=="NZL_2008"
replace A2038_6 =0 if C3011_F==5 & Z1004=="NZL_2008"
replace A2038_6 =0 if C3011_F<5  & Z1004=="NZL_2008"
replace A2038_6 =0 if C3011_F==.  & Z1004=="NZL_2008"
*list C3011_H A2038_5 if Z1004=="NZL_2008"
*tab A2038_6 if Z1004=="NZL_2008"

replace A2038_7 =1 if C3011_G<5 & Z1004=="NZL_2008"
replace A2038_7 =0 if C3011_G==5 & Z1004=="NZL_2008"
replace A2038_7 =0 if C3011_G>5  & Z1004=="NZL_2008"
replace A2038_7 =0 if C3011_G==.  & Z1004=="NZL_2008"
*list C3011_G A2038_7 if Z1004=="NZL_2008"
*tab A2038_7 if Z1004=="NZL_2008"

replace A2038_8 =0 if C3011_H<5 & Z1004=="NZL_2008"
replace A2038_8 =0 if C3011_H==5 & Z1004=="NZL_2008"
replace A2038_8 =1 if C3011_H>5  & Z1004=="NZL_2008"
replace A2038_8 =0 if C3011_H==.  & Z1004=="NZL_2008"
*list C3011_H A2038_8 if Z1004=="NZL_2008"
*tab A2038_8 if Z1004=="NZL_2008"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7+A2038_8)/8 if Z1004=="NZL_2008"
*tab A2038 if Z1004=="NZL_2008"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="NZL_2008"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="NZL_2008"
*tab  A2039_1 if Z1004=="NZL_2008"
***missings
sum C3011_A if Z1004=="NZL_2008"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="NZL_2008"
replace A2039_1_b= C5017_A-(6.85+2.21) if C3011_A==. & Z1004=="NZL_2008"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="NZL_2008"
*tab  A2039_1_b if Z1004=="NZL_2008"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="NZL_2008"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="NZL_2008"
*tab  A2039_2 if Z1004=="NZL_2008"
***missings
sum C3011_B if Z1004=="NZL_2008"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="NZL_2008"
replace A2039_2_b= C5017_B-(3.66+2.45) if C3011_B==. & Z1004=="NZL_2008"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="NZL_2008"
*tab  A2039_2_b if Z1004=="NZL_2008"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="NZL_2008"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="NZL_2008"
*tab  A2039_3 if Z1004=="NZL_2008"
***missings
sum C3011_C if Z1004=="NZL_2008"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="NZL_2008"
replace A2039_3_b= C5017_C-(2.54+2.27) if C3011_C==. & Z1004=="NZL_2008"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="NZL_2008"
*tab  A2039_3_b if Z1004=="NZL_2008"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="NZL_2008"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="NZL_2008"
*tab  A2039_4 if Z1004=="NZL_2008"
***missings
sum C3011_E if Z1004=="NZL_2008"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="NZL_2008"
replace A2039_4_b= C5017_E-(7.55+2.58) if C3011_E==. & Z1004=="NZL_2008"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="NZL_2008"
*tab  A2039_4_b if Z1004=="NZL_2008"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="NZL_2008"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="NZL_2008"
*tab  A2039_5 if Z1004=="NZL_2008"
***missings
sum C3011_D if Z1004=="NZL_2008"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="NZL_2008"
replace A2039_5_b= C5017_D-(5.26+2.21) if C3011_D==. & Z1004=="NZL_2008"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="NZL_2008"
*tab  A2039_5_b if Z1004=="NZL_2008"

*Party F
replace A2039_6 = C5017_F-C3011_F if Z1004=="NZL_2008"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="NZL_2008"
*tab  A2039_6 if Z1004=="NZL_2008"
***missings
sum C3011_F if Z1004=="NZL_2008"
replace A2039_6_b = C5017_F-C3011_F if Z1004=="NZL_2008"
replace A2039_6_b= C5017_F-(4.09+2.16) if C3011_F==. & Z1004=="NZL_2008"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="NZL_2008"
*tab  A2039_6_b if Z1004=="NZL_2008"

*Party G
replace A2039_7 = C5017_G-C3011_G if Z1004=="NZL_2008"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="NZL_2008"
*tab  A2039_7 if Z1004=="NZL_2008"
***missings
sum C3011_G if Z1004=="NZL_2008"
replace A2039_7_b = C5017_G-C3011_G if Z1004=="NZL_2008"
replace A2039_7_b= C5017_G-(3.14+2.22) if C3011_G==. & Z1004=="NZL_2008"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="NZL_2008"
*tab  A2039_7_b if Z1004=="NZL_2008"

*Party H
replace A2039_8 = C5017_H-C3011_H if Z1004=="NZL_2008"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="NZL_2008"
*tab  A2039_8 if Z1004=="NZL_2008"
***missings
sum C3011_H if Z1004=="NZL_2008"
replace A2039_8_b = C5017_H-C3011_H if Z1004=="NZL_2008"
replace A2039_8_b= C5017_H-(5.71+2.26) if C3011_H==. & Z1004=="NZL_2008"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="NZL_2008"
*tab  A2039_8_b if Z1004=="NZL_2008"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7+A2039_8)/8 if Z1004=="NZL_2008"
sum A2039 if Z1004=="NZL_2008"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b+A2039_8_b)/8 if Z1004=="NZL_2008"
sum  A2039_B if Z1004=="NZL_2008"
****************************************************************************************

sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="NOR_2005" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="NOR_2005" 

*tab C3011_A if Z1004=="NOR_2005", mis
*tab C3011_B if Z1004=="NOR_2005", mis
*tab C3011_C if Z1004=="NOR_2005", mis
*tab C3011_D if Z1004=="NOR_2005", mis
*tab C3011_E if Z1004=="NOR_2005", mis
*tab C3011_F if Z1004=="NOR_2005", mis
*tab C3011_G if Z1004=="NOR_2005", mis
*tab C3011_H if Z1004=="NOR_2005", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2005"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2005"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2005"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2005"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2005"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2005"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2005"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2005"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2005"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*8 parties 
** DAFEGBC
replace A2037_1 =1 if C3011_D< C3011_A & Z1004=="NOR_2005"
replace A2037_1 =0 if C3011_D> C3011_A & Z1004=="NOR_2005"
replace A2037_1 =0 if C3011_D == C3011_A & Z1004=="NOR_2005"
replace A2037_1 =0 if C3011_D ==. & Z1004=="NOR_2005"
replace A2037_1 =0 if C3011_A ==. & Z1004=="NOR_2005"
*list A2037_1 C3011_E C3011_F if Z1004=="NOR_2005"
*tab A2037_1 if Z1004=="NOR_2005", miss

replace A2037_2 =1 if C3011_A< C3011_F & Z1004=="NOR_2005"
replace A2037_2 =0 if C3011_A> C3011_F & Z1004=="NOR_2005"
replace A2037_2 =0 if C3011_A == C3011_F & Z1004=="NOR_2005"
replace A2037_2 =0 if C3011_A ==. & Z1004=="NOR_2005"
replace A2037_2 =0 if C3011_F ==. & Z1004=="NOR_2005"
*list A2037_2 C3011_F C3011_B if Z1004=="NOR_2005"
*tab A2037_2 if Z1004=="NOR_2005", miss

replace A2037_3 =1 if C3011_F< C3011_E & Z1004=="NOR_2005"
replace A2037_3 =0 if C3011_F> C3011_E & Z1004=="NOR_2005"
replace A2037_3 =0 if C3011_F == C3011_E & Z1004=="NOR_2005"
replace A2037_3 =0 if C3011_F ==. & Z1004=="NOR_2005"
replace A2037_3 =0 if C3011_E ==. & Z1004=="NOR_2005"
*list A2037_3 C3011_B C3011_F if Z1004=="NOR_2005"
*tab A2037_3 if Z1004=="NOR_2005", miss

replace A2037_4 =1 if C3011_E< C3011_G & Z1004=="NOR_2005"
replace A2037_4 =0 if C3011_E> C3011_G & Z1004=="NOR_2005"
replace A2037_4 =0 if C3011_E == C3011_G & Z1004=="NOR_2005"
replace A2037_4 =0 if C3011_E ==. & Z1004=="NOR_2005"
replace A2037_4 =0 if C3011_G ==. & Z1004=="NOR_2005"
*list A2037_4 C3011_C C3011_H if Z1004=="NOR_2005"
*tab A2037_4 if Z1004=="NOR_2005"

replace A2037_5 =1 if C3011_G< C3011_B & Z1004=="NOR_2005"
replace A2037_5 =0 if C3011_G> C3011_B & Z1004=="NOR_2005"
replace A2037_5 =0 if C3011_G == C3011_B & Z1004=="NOR_2005"
replace A2037_5 =0 if C3011_G ==. & Z1004=="NOR_2005"
replace A2037_5 =0 if C3011_G ==. & Z1004=="NOR_2005"
*list A2037_5 C3011_D C3011_H if Z1004=="NOR_2005"
*tab A2037_5 if Z1004=="NOR_2005", miss

replace A2037_6 =1 if C3011_B< C3011_C & Z1004=="NOR_2005"
replace A2037_6 =0 if C3011_B> C3011_C & Z1004=="NOR_2005"
replace A2037_6 =0 if C3011_B == C3011_C & Z1004=="NOR_2005"
replace A2037_6 =0 if C3011_B ==. & Z1004=="NOR_2005"
replace A2037_6 =0 if C3011_C ==. & Z1004=="NOR_2005"
*list A2037_6 C3011_D C3011_A if Z1004=="NOR_2005"
*tab A2037_6 if Z1004=="NOR_2005", miss

replace A2037_7 =1 if C3011_H< C3011_C & Z1004=="NOR_2005"
replace A2037_7 =0 if C3011_H> C3011_C & Z1004=="NOR_2005"
replace A2037_7 =0 if C3011_H == C3011_C & Z1004=="NOR_2005"
replace A2037_7 =0 if C3011_H ==. & Z1004=="NOR_2005"
replace A2037_7 =0 if C3011_E ==. & Z1004=="NOR_2005"
*list A2037_7 C3011_F C3011_G if Z1004=="NOR_2005"
*tab A2037_7 if Z1004=="NOR_2005", miss

replace A2037_8 =1 if C3011_H< C3011_D & Z1004=="NOR_2005"
replace A2037_8 =0 if C3011_H> C3011_D & Z1004=="NOR_2005"
replace A2037_8 =0 if C3011_H == C3011_D & Z1004=="NOR_2005"
replace A2037_8 =0 if C3011_H ==. & Z1004=="NOR_2005"
replace A2037_8 =0 if C3011_D ==. & Z1004=="NOR_2005"
*list A2037_8 C3011_E C3011_G if Z1004=="NOR_2005"
*tab A2037_8 if Z1004=="NOR_2005", miss

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7+A2037_8)/8 if Z1004=="NOR_2005"
*tab A2037 if Z1004=="NOR_2005"

*ii)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =1 if C3011_A<5 & Z1004=="NOR_2005"
replace A2038_1 =0 if C3011_A==5 & Z1004=="NOR_2005"
replace A2038_1 =0 if C3011_A>5  & Z1004=="NOR_2005"
replace A2038_1 =0 if C3011_A==.  & Z1004=="NOR_2005"
*tab A2038_1 if Z1004=="NOR_2005"

replace A2038_2 =1 if C3011_B>5 & Z1004=="NOR_2005"
replace A2038_2 =0 if C3011_B==5 & Z1004=="NOR_2005"
replace A2038_2 =0 if C3011_B<5  & Z1004=="NOR_2005"
replace A2038_2 =0 if C3011_B==.  & Z1004=="NOR_2005"
*list A2038_2 C3011_B if Z1004=="NOR_2005"
*tab A2038_2 if Z1004=="NOR_2005"

replace A2038_3 =1 if C3011_C>5 & Z1004=="NOR_2005"
replace A2038_3 =0 if C3011_C==5 & Z1004=="NOR_2005"
replace A2038_3 =0 if C3011_C<5  & Z1004=="NOR_2005"
replace A2038_3 =0 if C3011_C==.  & Z1004=="NOR_2005"
*tab A2038_3 if Z1004=="NOR_2005"
*list C3011_C A2038_3 if Z1004=="NOR_2005"

replace A2038_4 =1 if C3011_D<5 & Z1004=="NOR_2005"
replace A2038_4 =0 if C3011_D==5 & Z1004=="NOR_2005"
replace A2038_4 =0 if C3011_D>5  & Z1004=="NOR_2005"
replace A2038_4 =0 if C3011_D==.  & Z1004=="NOR_2005"
*list C3011_D A2038_4 if Z1004=="NOR_2005"
*tab A2038_4 if Z1004=="NOR_2005"

replace A2038_5 =0 if C3011_E<5 & Z1004=="NOR_2005"
replace A2038_5 =1 if C3011_E==5 & Z1004=="NOR_2005"
replace A2038_5 =0 if C3011_E>5  & Z1004=="NOR_2005"
replace A2038_5 =0 if C3011_E==.  & Z1004=="NOR_2005"
*list C3011_E A2038_4 if Z1004=="NOR_2005"
*tab A2038_5 if Z1004=="NOR_2005"

replace A2038_6 =0 if C3011_F>5 & Z1004=="NOR_2005"
replace A2038_6 =0 if C3011_F==5 & Z1004=="NOR_2005"
replace A2038_6 =1 if C3011_F<5  & Z1004=="NOR_2005"
replace A2038_6 =0 if C3011_F==.  & Z1004=="NOR_2005"
*list C3011_H A2038_5 if Z1004=="NOR_2005"
*tab A2038_6 if Z1004=="NOR_2005"

replace A2038_7 =0 if C3011_G<5 & Z1004=="NOR_2005"
replace A2038_7 =0 if C3011_G==5 & Z1004=="NOR_2005"
replace A2038_7 =1 if C3011_G>5  & Z1004=="NOR_2005"
replace A2038_7 =0 if C3011_G==.  & Z1004=="NOR_2005"
*list C3011_G A2038_7 if Z1004=="NOR_2005"
*tab A2038_7 if Z1004=="NOR_2005"

replace A2038_8 =1 if C3011_H<5 & Z1004=="NOR_2005"
replace A2038_8 =0 if C3011_H==5 & Z1004=="NOR_2005"
replace A2038_8 =0 if C3011_H>5  & Z1004=="NOR_2005"
replace A2038_8 =0 if C3011_H==.  & Z1004=="NOR_2005"
*list C3011_H A2038_8 if Z1004=="NOR_2005"
*tab A2038_8 if Z1004=="NOR_2005"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7+A2038_8)/8 if Z1004=="NOR_2005"
*tab A2038 if Z1004=="NOR_2005"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="NOR_2005"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="NOR_2005"
*tab  A2039_1 if Z1004=="NOR_2005"
***missings
sum C3011_A if Z1004=="NOR_2005"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="NOR_2005"
replace A2039_1_b= C5017_A-(3.99+1.75) if C3011_A==. & Z1004=="NOR_2005"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="NOR_2005"
*tab  A2039_1_b if Z1004=="NOR_2005"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="NOR_2005"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="NOR_2005"
*tab  A2039_2 if Z1004=="NOR_2005"
***missings
sum C3011_B if Z1004=="NOR_2005"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="NOR_2005"
replace A2039_2_b= C5017_B-(8.36+1.94) if C3011_B==. & Z1004=="NOR_2005"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="NOR_2005"
*tab  A2039_2_b if Z1004=="NOR_2005"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="NOR_2005"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="NOR_2005"
*tab  A2039_3 if Z1004=="NOR_2005"
***missings
sum C3011_C if Z1004=="NOR_2005"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="NOR_2005"
replace A2039_3_b= C5017_C-(8.03+1.54) if C3011_C==. & Z1004=="NOR_2005"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="NOR_2005"
*tab  A2039_3_b if Z1004=="NOR_2005"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="NOR_2005"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="NOR_2005"
*tab  A2039_4 if Z1004=="NOR_2005"
***missings
sum C3011_E if Z1004=="NOR_2005"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="NOR_2005"
replace A2039_4_b= C5017_E-(6.15+1.64) if C3011_E==. & Z1004=="NOR_2005"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="NOR_2005"
*tab  A2039_4_b if Z1004=="NOR_2005"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="NOR_2005"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="NOR_2005"
*tab  A2039_5 if Z1004=="NOR_2005"
***missings
sum C3011_D if Z1004=="NOR_2005"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="NOR_2005"
replace A2039_5_b= C5017_D-(2.5+1.47) if C3011_D==. & Z1004=="NOR_2005"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="NOR_2005"
*tab  A2039_5_b if Z1004=="NOR_2005"

*Party F
replace A2039_6 = C5017_F-C3011_F if Z1004=="NOR_2005"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="NOR_2005"
*tab  A2039_6 if Z1004=="NOR_2005"
***missings
sum C3011_F if Z1004=="NOR_2005"
replace A2039_6_b = C5017_F-C3011_F if Z1004=="NOR_2005"
replace A2039_6_b= C5017_F-(4.39+1.35) if C3011_F==. & Z1004=="NOR_2005"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="NOR_2005"
*tab  A2039_6_b if Z1004=="NOR_2005"

*Party G
replace A2039_7 = C5017_G-C3011_G if Z1004=="NOR_2005"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="NOR_2005"
*tab  A2039_7 if Z1004=="NOR_2005"
***missings
sum C3011_G if Z1004=="NOR_2005"
replace A2039_7_b = C5017_G-C3011_G if Z1004=="NOR_2005"
replace A2039_7_b= C5017_G-(4.78+2.06) if C3011_G==. & Z1004=="NOR_2005"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="NOR_2005"
*tab  A2039_7_b if Z1004=="NOR_2005"

*Party H
replace A2039_8 = C5017_H-C3011_H if Z1004=="NOR_2005"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="NOR_2005"
*tab  A2039_8 if Z1004=="NOR_2005"
***missings
sum C3011_H if Z1004=="NOR_2005"
replace A2039_8_b = C5017_H-C3011_H if Z1004=="NOR_2005"
replace A2039_8_b= C5017_H-(1.19+1.67) if C3011_H==. & Z1004=="NOR_2005"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="NOR_2005"
*tab  A2039_8_b if Z1004=="NOR_2005"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7+A2039_8)/8 if Z1004=="NOR_2005"
sum A2039 if Z1004=="NOR_2005"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b+A2039_8_b)/8 if Z1004=="NOR_2005"
sum  A2039_B if Z1004=="NOR_2005"
****************************************************************************************
sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="NOR_2009" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="NOR_2009" 

*tab C3011_A if Z1004=="NOR_2009", mis
*tab C3011_B if Z1004=="NOR_2009", mis
*tab C3011_C if Z1004=="NOR_2009", mis
*tab C3011_D if Z1004=="NOR_2009", mis
*tab C3011_E if Z1004=="NOR_2009", mis
*tab C3011_F if Z1004=="NOR_2009", mis
*tab C3011_G if Z1004=="NOR_2009", mis
*tab C3011_H if Z1004=="NOR_2009", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2009"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2009"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2009"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2009"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2009"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2009"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2009"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2009"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="NOR_2009"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*8 parties 
** HDAEFGBC
replace A2037_1 =0 if C3011_D< C3011_H & Z1004=="NOR_2009"
replace A2037_1 =1 if C3011_D> C3011_H & Z1004=="NOR_2009"
replace A2037_1 =0 if C3011_D == C3011_H & Z1004=="NOR_2009"
replace A2037_1 =0 if C3011_D ==. & Z1004=="NOR_2009"
replace A2037_1 =0 if C3011_H ==. & Z1004=="NOR_2009"
*list A2037_1 C3011_E C3011_F if Z1004=="NOR_2009"
*tab A2037_1 if Z1004=="NOR_2009", miss

replace A2037_2 =0 if C3011_A< C3011_D & Z1004=="NOR_2009"
replace A2037_2 =1 if C3011_A> C3011_D & Z1004=="NOR_2009"
replace A2037_2 =0 if C3011_A == C3011_D & Z1004=="NOR_2009"
replace A2037_2 =0 if C3011_A ==. & Z1004=="NOR_2009"
replace A2037_2 =0 if C3011_D ==. & Z1004=="NOR_2009"
*list A2037_2 C3011_F C3011_B if Z1004=="NOR_2009"
*tab A2037_2 if Z1004=="NOR_2009", miss

replace A2037_3 =1 if C3011_A< C3011_E & Z1004=="NOR_2009"
replace A2037_3 =0 if C3011_A> C3011_E & Z1004=="NOR_2009"
replace A2037_3 =0 if C3011_A == C3011_E & Z1004=="NOR_2009"
replace A2037_3 =0 if C3011_A ==. & Z1004=="NOR_2009"
replace A2037_3 =0 if C3011_E ==. & Z1004=="NOR_2009"
*list A2037_3 C3011_B C3011_F if Z1004=="NOR_2009"
*tab A2037_3 if Z1004=="NOR_2009", miss

replace A2037_4 =1 if C3011_E< C3011_F & Z1004=="NOR_2009"
replace A2037_4 =0 if C3011_E> C3011_F & Z1004=="NOR_2009"
replace A2037_4 =0 if C3011_E == C3011_F & Z1004=="NOR_2009"
replace A2037_4 =0 if C3011_E ==. & Z1004=="NOR_2009"
replace A2037_4 =0 if C3011_F ==. & Z1004=="NOR_2009"
*list A2037_4 C3011_C C3011_H if Z1004=="NOR_2009"
*tab A2037_4 if Z1004=="NOR_2009"

replace A2037_5 =0 if C3011_G< C3011_F & Z1004=="NOR_2009"
replace A2037_5 =1 if C3011_G> C3011_F & Z1004=="NOR_2009"
replace A2037_5 =0 if C3011_G == C3011_F & Z1004=="NOR_2009"
replace A2037_5 =0 if C3011_G ==. & Z1004=="NOR_2009"
replace A2037_5 =0 if C3011_F ==. & Z1004=="NOR_2009"
*list A2037_5 C3011_D C3011_H if Z1004=="NOR_2009"
*tab A2037_5 if Z1004=="NOR_2009", miss

replace A2037_6 =0 if C3011_B< C3011_G & Z1004=="NOR_2009"
replace A2037_6 =1 if C3011_B> C3011_G & Z1004=="NOR_2009"
replace A2037_6 =0 if C3011_B == C3011_G & Z1004=="NOR_2009"
replace A2037_6 =0 if C3011_B ==. & Z1004=="NOR_2009"
replace A2037_6 =0 if C3011_G ==. & Z1004=="NOR_2009"
*list A2037_6 C3011_D C3011_A if Z1004=="NOR_2009"
*tab A2037_6 if Z1004=="NOR_2009", miss

replace A2037_7 =1 if C3011_B< C3011_C & Z1004=="NOR_2009"
replace A2037_7 =0 if C3011_B> C3011_C & Z1004=="NOR_2009"
replace A2037_7 =0 if C3011_B == C3011_C & Z1004=="NOR_2009"
replace A2037_7 =0 if C3011_B ==. & Z1004=="NOR_2009"
replace A2037_7 =0 if C3011_C ==. & Z1004=="NOR_2009"
*list A2037_7 C3011_F C3011_G if Z1004=="NOR_2009"
*tab A2037_7 if Z1004=="NOR_2009", miss

replace A2037_8 =1 if C3011_H< C3011_C & Z1004=="NOR_2009"
replace A2037_8 =0 if C3011_H> C3011_C & Z1004=="NOR_2009"
replace A2037_8 =0 if C3011_H == C3011_C & Z1004=="NOR_2009"
replace A2037_8 =0 if C3011_H ==. & Z1004=="NOR_2009"
replace A2037_8 =0 if C3011_C ==. & Z1004=="NOR_2009"
*list A2037_8 C3011_E C3011_G if Z1004=="NOR_2009"
*tab A2037_8 if Z1004=="NOR_2009", miss

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7+A2037_8)/8 if Z1004=="NOR_2009"
*tab A2037 if Z1004=="NOR_2009"

*ii)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =1 if C3011_A<5 & Z1004=="NOR_2009"
replace A2038_1 =0 if C3011_A==5 & Z1004=="NOR_2009"
replace A2038_1 =0 if C3011_A>5  & Z1004=="NOR_2009"
replace A2038_1 =0 if C3011_A==.  & Z1004=="NOR_2009"
*tab A2038_1 if Z1004=="NOR_2009"

replace A2038_2 =1 if C3011_B>5 & Z1004=="NOR_2009"
replace A2038_2 =0 if C3011_B==5 & Z1004=="NOR_2009"
replace A2038_2 =0 if C3011_B<5  & Z1004=="NOR_2009"
replace A2038_2 =0 if C3011_B==.  & Z1004=="NOR_2009"
*list A2038_2 C3011_B if Z1004=="NOR_2009"
*tab A2038_2 if Z1004=="NOR_2009"

replace A2038_3 =1 if C3011_C>5 & Z1004=="NOR_2009"
replace A2038_3 =0 if C3011_C==5 & Z1004=="NOR_2009"
replace A2038_3 =0 if C3011_C<5  & Z1004=="NOR_2009"
replace A2038_3 =0 if C3011_C==.  & Z1004=="NOR_2009"
*tab A2038_3 if Z1004=="NOR_2009"
*list C3011_C A2038_3 if Z1004=="NOR_2009"

replace A2038_4 =1 if C3011_D<5 & Z1004=="NOR_2009"
replace A2038_4 =0 if C3011_D==5 & Z1004=="NOR_2009"
replace A2038_4 =0 if C3011_D>5  & Z1004=="NOR_2009"
replace A2038_4 =0 if C3011_D==.  & Z1004=="NOR_2009"
*list C3011_D A2038_4 if Z1004=="NOR_2009"
*tab A2038_4 if Z1004=="NOR_2009"

replace A2038_5 =1 if C3011_E<5 & Z1004=="NOR_2009"
replace A2038_5 =0 if C3011_E==5 & Z1004=="NOR_2009"
replace A2038_5 =0 if C3011_E>5  & Z1004=="NOR_2009"
replace A2038_5 =0 if C3011_E==.  & Z1004=="NOR_2009"
*list C3011_E A2038_4 if Z1004=="NOR_2009"
*tab A2038_5 if Z1004=="NOR_2009"

replace A2038_6 =0 if C3011_F>5 & Z1004=="NOR_2009"
replace A2038_6 =1 if C3011_F==5 & Z1004=="NOR_2009"
replace A2038_6 =0 if C3011_F<5  & Z1004=="NOR_2009"
replace A2038_6 =0 if C3011_F==.  & Z1004=="NOR_2009"
*list C3011_H A2038_5 if Z1004=="NOR_2009"
*tab A2038_6 if Z1004=="NOR_2009"

replace A2038_7 =0 if C3011_G<5 & Z1004=="NOR_2009"
replace A2038_7 =0 if C3011_G==5 & Z1004=="NOR_2009"
replace A2038_7 =1 if C3011_G>5  & Z1004=="NOR_2009"
replace A2038_7 =0 if C3011_G==.  & Z1004=="NOR_2009"
*list C3011_G A2038_7 if Z1004=="NOR_2009"
*tab A2038_7 if Z1004=="NOR_2009"

replace A2038_8 =1 if C3011_H<5 & Z1004=="NOR_2009"
replace A2038_8 =0 if C3011_H==5 & Z1004=="NOR_2009"
replace A2038_8 =0 if C3011_H>5  & Z1004=="NOR_2009"
replace A2038_8 =0 if C3011_H==.  & Z1004=="NOR_2009"
*list C3011_H A2038_8 if Z1004=="NOR_2009"
*tab A2038_8 if Z1004=="NOR_2009"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7+A2038_8)/8 if Z1004=="NOR_2009"
*tab A2038 if Z1004=="NOR_2009"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="NOR_2009"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="NOR_2009"
*tab  A2039_1 if Z1004=="NOR_2009"
***missings
sum C3011_A if Z1004=="NOR_2009"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="NOR_2009"
replace A2039_1_b= C5017_A-(4.19+1.7) if C3011_A==. & Z1004=="NOR_2009"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="NOR_2009"
*tab  A2039_1_b if Z1004=="NOR_2009"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="NOR_2009"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="NOR_2009"
*tab  A2039_2 if Z1004=="NOR_2009"
***missings
sum C3011_B if Z1004=="NOR_2009"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="NOR_2009"
replace A2039_2_b= C5017_B-(8.64+1.79) if C3011_B==. & Z1004=="NOR_2009"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="NOR_2009"
*tab  A2039_2_b if Z1004=="NOR_2009"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="NOR_2009"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="NOR_2009"
*tab  A2039_3 if Z1004=="NOR_2009"
***missings
sum C3011_C if Z1004=="NOR_2009"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="NOR_2009"
replace A2039_3_b= C5017_C-(7.93+1.43) if C3011_C==. & Z1004=="NOR_2009"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="NOR_2009"
*tab  A2039_3_b if Z1004=="NOR_2009"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="NOR_2009"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="NOR_2009"
*tab  A2039_4 if Z1004=="NOR_2009"
***missings
sum C3011_E if Z1004=="NOR_2009"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="NOR_2009"
replace A2039_4_b= C5017_E-(4.48+1.31) if C3011_E==. & Z1004=="NOR_2009"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="NOR_2009"
*tab  A2039_4_b if Z1004=="NOR_2009"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="NOR_2009"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="NOR_2009"
*tab  A2039_5 if Z1004=="NOR_2009"
***missings
sum C3011_D if Z1004=="NOR_2009"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="NOR_2009"
replace A2039_5_b= C5017_D-(2.49+1.48) if C3011_D==. & Z1004=="NOR_2009"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="NOR_2009"
*tab  A2039_5_b if Z1004=="NOR_2009"

*Party F
replace A2039_6 = C5017_F-C3011_F if Z1004=="NOR_2009"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="NOR_2009"
*tab  A2039_6 if Z1004=="NOR_2009"
***missings
sum C3011_F if Z1004=="NOR_2009"
replace A2039_6_b = C5017_F-C3011_F if Z1004=="NOR_2009"
replace A2039_6_b= C5017_F-(5.81+1.53) if C3011_F==. & Z1004=="NOR_2009"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="NOR_2009"
*tab  A2039_6_b if Z1004=="NOR_2009"

*Party G
replace A2039_7 = C5017_G-C3011_G if Z1004=="NOR_2009"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="NOR_2009"
*tab  A2039_7 if Z1004=="NOR_2009"
***missings
sum C3011_G if Z1004=="NOR_2009"
replace A2039_7_b = C5017_G-C3011_G if Z1004=="NOR_2009"
replace A2039_7_b= C5017_G-(4.48+1.90) if C3011_G==. & Z1004=="NOR_2009"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="NOR_2009"
*tab  A2039_7_b if Z1004=="NOR_2009"

*Party H
replace A2039_8 = C5017_H-C3011_H if Z1004=="NOR_2009"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="NOR_2009"
*tab  A2039_8 if Z1004=="NOR_2009"
***missings
sum C3011_H if Z1004=="NOR_2009"
replace A2039_8_b = C5017_H-C3011_H if Z1004=="NOR_2009"
replace A2039_8_b= C5017_H-(1.15+1.61) if C3011_H==. & Z1004=="NOR_2009"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="NOR_2009"
*tab  A2039_8_b if Z1004=="NOR_2009"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7+A2039_8)/8 if Z1004=="NOR_2009"
sum A2039 if Z1004=="NOR_2009"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b+A2039_8_b)/8 if Z1004=="NOR_2009"
sum  A2039_B if Z1004=="NOR_2009"

****************************************************************************************
sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="POL_2005" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="POL_2005" 

*tab C3011_A if Z1004=="POL_2005", mis
*tab C3011_B if Z1004=="POL_2005", mis
*tab C3011_C if Z1004=="POL_2005", mis
*tab C3011_D if Z1004=="POL_2005", mis
*tab C3011_E if Z1004=="POL_2005", mis
*tab C3011_F if Z1004=="POL_2005", mis
*tab C3011_G if Z1004=="POL_2005", mis
*tab C3011_H if Z1004=="POL_2005", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="POL_2005"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="POL_2005"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="POL_2005"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="POL_2005"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="POL_2005"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="POL_2005"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="POL_2005"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="POL_2005"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="POL_2005"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*8 parties 
** CDHFGBAE
replace A2037_1 =0 if C3011_D< C3011_C & Z1004=="POL_2005"
replace A2037_1 =0 if C3011_D> C3011_C & Z1004=="POL_2005"
replace A2037_1 =1 if C3011_D == C3011_C & Z1004=="POL_2005"
replace A2037_1 =0 if C3011_D ==. & Z1004=="POL_2005"
replace A2037_1 =0 if C3011_C ==. & Z1004=="POL_2005"
*list A2037_1 C3011_E C3011_F if Z1004=="POL_2005"
*tab A2037_1 if Z1004=="POL_2005", miss

replace A2037_2 =0 if C3011_H< C3011_D & Z1004=="POL_2005"
replace A2037_2 =1 if C3011_H> C3011_D & Z1004=="POL_2005"
replace A2037_2 =0 if C3011_H == C3011_D & Z1004=="POL_2005"
replace A2037_2 =0 if C3011_H ==. & Z1004=="POL_2005"
replace A2037_2 =0 if C3011_D ==. & Z1004=="POL_2005"
*list A2037_2 C3011_F C3011_B if Z1004=="POL_2005"
*tab A2037_2 if Z1004=="POL_2005", miss

replace A2037_3 =1 if C3011_H< C3011_F & Z1004=="POL_2005"
replace A2037_3 =0 if C3011_H> C3011_F & Z1004=="POL_2005"
replace A2037_3 =0 if C3011_H == C3011_F & Z1004=="POL_2005"
replace A2037_3 =0 if C3011_H ==. & Z1004=="POL_2005"
replace A2037_3 =0 if C3011_F ==. & Z1004=="POL_2005"
*list A2037_3 C3011_B C3011_F if Z1004=="POL_2005"
*tab A2037_3 if Z1004=="POL_2005", miss

replace A2037_4 =0 if C3011_G< C3011_F & Z1004=="POL_2005"
replace A2037_4 =0 if C3011_G> C3011_F & Z1004=="POL_2005"
replace A2037_4 =1 if C3011_G == C3011_F & Z1004=="POL_2005"
replace A2037_4 =0 if C3011_G ==. & Z1004=="POL_2005"
replace A2037_4 =0 if C3011_F ==. & Z1004=="POL_2005"
*list A2037_4 C3011_C C3011_H if Z1004=="POL_2005"
*tab A2037_4 if Z1004=="POL_2005"

replace A2037_5 =1 if C3011_C< C3011_E & Z1004=="POL_2005"
replace A2037_5 =0 if C3011_C> C3011_E & Z1004=="POL_2005"
replace A2037_5 =0 if C3011_C == C3011_E & Z1004=="POL_2005"
replace A2037_5 =0 if C3011_C ==. & Z1004=="POL_2005"
replace A2037_5 =0 if C3011_E ==. & Z1004=="POL_2005"
*list A2037_5 C3011_D C3011_H if Z1004=="POL_2005"
*tab A2037_5 if Z1004=="POL_2005", miss

replace A2037_6 =0 if C3011_B< C3011_G & Z1004=="POL_2005"
replace A2037_6 =1 if C3011_B> C3011_G & Z1004=="POL_2005"
replace A2037_6 =0 if C3011_B == C3011_G & Z1004=="POL_2005"
replace A2037_6 =0 if C3011_B ==. & Z1004=="POL_2005"
replace A2037_6 =0 if C3011_G ==. & Z1004=="POL_2005"
*list A2037_6 C3011_D C3011_A if Z1004=="POL_2005"
*tab A2037_6 if Z1004=="POL_2005", miss

replace A2037_7 =1 if C3011_B< C3011_A & Z1004=="POL_2005"
replace A2037_7 =0 if C3011_B> C3011_A & Z1004=="POL_2005"
replace A2037_7 =0 if C3011_B == C3011_A & Z1004=="POL_2005"
replace A2037_7 =0 if C3011_B ==. & Z1004=="POL_2005"
replace A2037_7 =0 if C3011_A ==. & Z1004=="POL_2005"
*list A2037_7 C3011_F C3011_G if Z1004=="POL_2005"
*tab A2037_7 if Z1004=="POL_2005", miss

replace A2037_8 =1 if C3011_A< C3011_E & Z1004=="POL_2005"
replace A2037_8 =0 if C3011_A> C3011_E & Z1004=="POL_2005"
replace A2037_8 =0 if C3011_A == C3011_E & Z1004=="POL_2005"
replace A2037_8 =0 if C3011_A ==. & Z1004=="POL_2005"
replace A2037_8 =0 if C3011_E ==. & Z1004=="POL_2005"
*list A2037_8 C3011_E C3011_G if Z1004=="POL_2005"
*tab A2037_8 if Z1004=="POL_2005", miss

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7+A2037_8)/8 if Z1004=="POL_2005"
*tab A2037 if Z1004=="POL_2005"

*ii)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =0 if C3011_A<5 & Z1004=="POL_2005"
replace A2038_1 =0 if C3011_A==5 & Z1004=="POL_2005"
replace A2038_1 =1 if C3011_A>5  & Z1004=="POL_2005"
replace A2038_1 =0 if C3011_A==.  & Z1004=="POL_2005"
*tab A2038_1 if Z1004=="POL_2005"

replace A2038_2 =1 if C3011_B>5 & Z1004=="POL_2005"
replace A2038_2 =0 if C3011_B==5 & Z1004=="POL_2005"
replace A2038_2 =0 if C3011_B<5  & Z1004=="POL_2005"
replace A2038_2 =0 if C3011_B==.  & Z1004=="POL_2005"
*list A2038_2 C3011_B if Z1004=="POL_2005"
*tab A2038_2 if Z1004=="POL_2005"

replace A2038_3 =0 if C3011_C>5 & Z1004=="POL_2005"
replace A2038_3 =0 if C3011_C==5 & Z1004=="POL_2005"
replace A2038_3 =1 if C3011_C<5  & Z1004=="POL_2005"
replace A2038_3 =0 if C3011_C==.  & Z1004=="POL_2005"
*tab A2038_3 if Z1004=="POL_2005"
*list C3011_C A2038_3 if Z1004=="POL_2005"

replace A2038_4 =1 if C3011_D<5 & Z1004=="POL_2005"
replace A2038_4 =0 if C3011_D==5 & Z1004=="POL_2005"
replace A2038_4 =0 if C3011_D>5  & Z1004=="POL_2005"
replace A2038_4 =0 if C3011_D==.  & Z1004=="POL_2005"
*list C3011_D A2038_4 if Z1004=="POL_2005"
*tab A2038_4 if Z1004=="POL_2005"

replace A2038_5 =0 if C3011_E<5 & Z1004=="POL_2005"
replace A2038_5 =0 if C3011_E==5 & Z1004=="POL_2005"
replace A2038_5 =1 if C3011_E>5  & Z1004=="POL_2005"
replace A2038_5 =0 if C3011_E==.  & Z1004=="POL_2005"
*list C3011_E A2038_4 if Z1004=="POL_2005"
*tab A2038_5 if Z1004=="POL_2005"

replace A2038_6 =0 if C3011_F>5 & Z1004=="POL_2005"
replace A2038_6 =0 if C3011_F==5 & Z1004=="POL_2005"
replace A2038_6 =1 if C3011_F<5  & Z1004=="POL_2005"
replace A2038_6 =0 if C3011_F==.  & Z1004=="POL_2005"
*list C3011_H A2038_5 if Z1004=="POL_2005"
*tab A2038_6 if Z1004=="POL_2005"

replace A2038_7 =1 if C3011_G<5 & Z1004=="POL_2005"
replace A2038_7 =0 if C3011_G==5 & Z1004=="POL_2005"
replace A2038_7 =0 if C3011_G>5  & Z1004=="POL_2005"
replace A2038_7 =0 if C3011_G==.  & Z1004=="POL_2005"
*list C3011_G A2038_7 if Z1004=="POL_2005"
*tab A2038_7 if Z1004=="POL_2005"

replace A2038_8 =1 if C3011_H<5 & Z1004=="POL_2005"
replace A2038_8 =0 if C3011_H==5 & Z1004=="POL_2005"
replace A2038_8 =0 if C3011_H>5  & Z1004=="POL_2005"
replace A2038_8 =0 if C3011_H==.  & Z1004=="POL_2005"
*list C3011_H A2038_8 if Z1004=="POL_2005"
*tab A2038_8 if Z1004=="POL_2005"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7+A2038_8)/8 if Z1004=="POL_2005"
*tab A2038 if Z1004=="POL_2005"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="POL_2005"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="POL_2005"
*tab  A2039_1 if Z1004=="POL_2005"
***missings
sum C3011_A if Z1004=="POL_2005"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="POL_2005"
replace A2039_1_b= C5017_A-(7.34+2.29) if C3011_A==. & Z1004=="POL_2005"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="POL_2005"
*tab  A2039_1_b if Z1004=="POL_2005"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="POL_2005"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="POL_2005"
*tab  A2039_2 if Z1004=="POL_2005"
***missings
sum C3011_B if Z1004=="POL_2005"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="POL_2005"
replace A2039_2_b= C5017_B-(6.63+2.41) if C3011_B==. & Z1004=="POL_2005"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="POL_2005"
*tab  A2039_2_b if Z1004=="POL_2005"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="POL_2005"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="POL_2005"
*tab  A2039_3 if Z1004=="POL_2005"
***missings
sum C3011_C if Z1004=="POL_2005"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="POL_2005"
replace A2039_3_b= C5017_C-(4.57+2.75) if C3011_C==. & Z1004=="POL_2005"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="POL_2005"
*tab  A2039_3_b if Z1004=="POL_2005"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="POL_2005"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="POL_2005"
*tab  A2039_4 if Z1004=="POL_2005"
***missings
sum C3011_E if Z1004=="POL_2005"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="POL_2005"
replace A2039_4_b= C5017_E-(6.48+2.78) if C3011_E==. & Z1004=="POL_2005"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="POL_2005"
*tab  A2039_4_b if Z1004=="POL_2005"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="POL_2005"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="POL_2005"
*tab  A2039_5 if Z1004=="POL_2005"
***missings
sum C3011_D if Z1004=="POL_2005"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="POL_2005"
replace A2039_5_b= C5017_D-(1.4+1.88) if C3011_D==. & Z1004=="POL_2005"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="POL_2005"
*tab  A2039_5_b if Z1004=="POL_2005"

*Party F
replace A2039_6 = C5017_F-C3011_F if Z1004=="POL_2005"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="POL_2005"
*tab  A2039_6 if Z1004=="POL_2005"
***missings
sum C3011_F if Z1004=="POL_2005"
replace A2039_6_b = C5017_F-C3011_F if Z1004=="POL_2005"
replace A2039_6_b= C5017_F-(4.41+2.23) if C3011_F==. & Z1004=="POL_2005"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="POL_2005"
*tab  A2039_6_b if Z1004=="POL_2005"

*Party G
replace A2039_7 = C5017_G-C3011_G if Z1004=="POL_2005"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="POL_2005"
*tab  A2039_7 if Z1004=="POL_2005"
***missings
sum C3011_G if Z1004=="POL_2005"
replace A2039_7_b = C5017_G-C3011_G if Z1004=="POL_2005"
replace A2039_7_b= C5017_G-(4.22+2.46) if C3011_G==. & Z1004=="POL_2005"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="POL_2005"
*tab  A2039_7_b if Z1004=="POL_2005"

*Party H
replace A2039_8 = C5017_H-C3011_H if Z1004=="POL_2005"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="POL_2005"
*tab  A2039_8 if Z1004=="POL_2005"
***missings
sum C3011_H if Z1004=="POL_2005"
replace A2039_8_b = C5017_H-C3011_H if Z1004=="POL_2005"
replace A2039_8_b= C5017_H-(2.43+2.09) if C3011_H==. & Z1004=="POL_2005"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="POL_2005"
*tab  A2039_8_b if Z1004=="POL_2005"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7+A2039_8)/8 if Z1004=="POL_2005"
sum A2039 if Z1004=="POL_2005"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b+A2039_8_b)/8 if Z1004=="POL_2005"
sum  A2039_B if Z1004=="POL_2005"

****************************************************************************************
***POL 2007
sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="POL_2007" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="POL_2007" 

*tab C3011_A if Z1004=="POL_2007", mis
*tab C3011_B if Z1004=="POL_2007", mis
*tab C3011_C if Z1004=="POL_2007", mis
*tab C3011_D if Z1004=="POL_2007", mis
*tab C3011_E if Z1004=="POL_2007", mis
*tab C3011_F if Z1004=="POL_2007", mis
*tab C3011_G if Z1004=="POL_2007", mis
*tab C3011_H if Z1004=="POL_2007", mis

**
mvdecode C3011_A, mv(92, 93, 95, 96, 97, 98, 99), if Z1004=="POL_2007"
mvdecode C3011_B, mv(92, 93, 95, 96, 97, 98, 99), if Z1004=="POL_2007"
mvdecode C3011_C, mv(92, 93, 95, 96, 97, 98, 99), if Z1004=="POL_2007"
mvdecode C3011_D, mv(92, 93, 95, 96, 97, 98, 99), if Z1004=="POL_2007"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="POL_2007"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="POL_2007"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="POL_2007"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="POL_2007"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="POL_2007"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*4 parties 
** CDAB
replace A2037_1 =0 if C3011_D< C3011_C & Z1004=="POL_2007"
replace A2037_1 =1 if C3011_D> C3011_C & Z1004=="POL_2007"
replace A2037_1 =0 if C3011_D == C3011_C & Z1004=="POL_2007"
replace A2037_1 =0 if C3011_D ==. & Z1004=="POL_2007"
replace A2037_1 =0 if C3011_C ==. & Z1004=="POL_2007"
*list A2037_1 C3011_E C3011_F if Z1004=="POL_2007"
*tab A2037_1 if Z1004=="POL_2007", miss

replace A2037_2 =0 if C3011_A< C3011_D & Z1004=="POL_2007"
replace A2037_2 =1 if C3011_A> C3011_D & Z1004=="POL_2007"
replace A2037_2 =0 if C3011_A == C3011_D & Z1004=="POL_2007"
replace A2037_2 =0 if C3011_A ==. & Z1004=="POL_2007"
replace A2037_2 =0 if C3011_D ==. & Z1004=="POL_2007"
*list A2037_2 C3011_F C3011_B if Z1004=="POL_2007"
*tab A2037_2 if Z1004=="POL_2007", miss

replace A2037_3 =1 if C3011_A< C3011_B & Z1004=="POL_2007"
replace A2037_3 =0 if C3011_A> C3011_B & Z1004=="POL_2007"
replace A2037_3 =0 if C3011_A == C3011_B & Z1004=="POL_2007"
replace A2037_3 =0 if C3011_A ==. & Z1004=="POL_2007"
replace A2037_3 =0 if C3011_B ==. & Z1004=="POL_2007"
*list A2037_3 C3011_B C3011_F if Z1004=="POL_2007"
*tab A2037_3 if Z1004=="POL_2007", miss

replace A2037_4 =1 if C3011_C< C3011_B & Z1004=="POL_2007"
replace A2037_4 =0 if C3011_C> C3011_B & Z1004=="POL_2007"
replace A2037_4 =0 if C3011_C == C3011_B & Z1004=="POL_2007"
replace A2037_4 =0 if C3011_C ==. & Z1004=="POL_2007"
replace A2037_4 =0 if C3011_B ==. & Z1004=="POL_2007"
*list A2037_4 C3011_C C3011_H if Z1004=="POL_2007"
*tab A2037_4 if Z1004=="POL_2007"

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4)/4 if Z1004=="POL_2007"
*tab A2037 if Z1004=="POL_2007"

*ii)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =0 if C3011_A<5 & Z1004=="POL_2007"
replace A2038_1 =0 if C3011_A==5 & Z1004=="POL_2007"
replace A2038_1 =1 if C3011_A>5  & Z1004=="POL_2007"
replace A2038_1 =0 if C3011_A==.  & Z1004=="POL_2007"
*tab A2038_1 if Z1004=="POL_2007"

replace A2038_2 =1 if C3011_B>5 & Z1004=="POL_2007"
replace A2038_2 =0 if C3011_B==5 & Z1004=="POL_2007"
replace A2038_2 =0 if C3011_B<5  & Z1004=="POL_2007"
replace A2038_2 =0 if C3011_B==.  & Z1004=="POL_2007"
*list A2038_2 C3011_B if Z1004=="POL_2007"
*tab A2038_2 if Z1004=="POL_2007"

replace A2038_3 =0 if C3011_C>5 & Z1004=="POL_2007"
replace A2038_3 =0 if C3011_C==5 & Z1004=="POL_2007"
replace A2038_3 =1 if C3011_C<5  & Z1004=="POL_2007"
replace A2038_3 =0 if C3011_C==.  & Z1004=="POL_2007"
*tab A2038_3 if Z1004=="POL_2007"
*list C3011_C A2038_3 if Z1004=="POL_2007"

replace A2038_4 =0 if C3011_D<5 & Z1004=="POL_2007"
replace A2038_4 =1 if C3011_D==5 & Z1004=="POL_2007"
replace A2038_4 =0 if C3011_D>5  & Z1004=="POL_2007"
replace A2038_4 =0 if C3011_D==.  & Z1004=="POL_2007"
*list C3011_D A2038_4 if Z1004=="POL_2007"
*tab A2038_4 if Z1004=="POL_2007"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4)/4 if Z1004=="POL_2007"
*tab A2038 if Z1004=="POL_2007"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="POL_2007"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="POL_2007"
*tab  A2039_1 if Z1004=="POL_2007"
***missings
sum C3011_A if Z1004=="POL_2007"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="POL_2007"
replace A2039_1_b= C5017_A-(6.3+2.30) if C3011_A==. & Z1004=="POL_2007"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="POL_2007"
*tab  A2039_1_b if Z1004=="POL_2007"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="POL_2007"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="POL_2007"
*tab  A2039_2 if Z1004=="POL_2007"
***missings
sum C3011_B if Z1004=="POL_2007"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="POL_2007"
replace A2039_2_b= C5017_B-(7.04+2.78) if C3011_B==. & Z1004=="POL_2007"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="POL_2007"
*tab  A2039_2_b if Z1004=="POL_2007"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="POL_2007"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="POL_2007"
*tab  A2039_3 if Z1004=="POL_2007"
***missings
sum C3011_C if Z1004=="POL_2007"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="POL_2007"
replace A2039_3_b= C5017_C-(1.97+2.09) if C3011_C==. & Z1004=="POL_2007"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="POL_2007"
*tab  A2039_3_b if Z1004=="POL_2007"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="POL_2007"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="POL_2007"
*tab  A2039_5 if Z1004=="POL_2007"
***missings
sum C3011_D if Z1004=="POL_2007"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="POL_2007"
replace A2039_5_b= C5017_D-(4.91+2.05) if C3011_D==. & Z1004=="POL_2007"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="POL_2007"
*tab  A2039_5_b if Z1004=="POL_2007"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_5)/4 if Z1004=="POL_2007"
sum A2039 if Z1004=="POL_2007"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_5_b)/4 if Z1004=="POL_2007"
sum  A2039_B if Z1004=="POL_2007"

****************************************************************************************
****PRT_2009
sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="PRT_2009" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="PRT_2009" 

*tab C3011_A if Z1004=="PRT_2009", mis
*tab C3011_B if Z1004=="PRT_2009", mis
*tab C3011_C if Z1004=="PRT_2009", mis
*tab C3011_D if Z1004=="PRT_2009", mis
*tab C3011_E if Z1004=="PRT_2009", mis
*tab C3011_F if Z1004=="PRT_2009", mis
*tab C3011_G if Z1004=="PRT_2009", mis
*tab C3011_H if Z1004=="PRT_2009", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="PRT_2009"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="PRT_2009"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="PRT_2009"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="PRT_2009"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="PRT_2009"



**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*8 parties 
** DEABC
replace A2037_1 =0 if C3011_D< C3011_E & Z1004=="PRT_2009"
replace A2037_1 =0 if C3011_D> C3011_E & Z1004=="PRT_2009"
replace A2037_1 =1 if C3011_D == C3011_E & Z1004=="PRT_2009"
replace A2037_1 =0 if C3011_D ==. & Z1004=="PRT_2009"
replace A2037_1 =0 if C3011_E ==. & Z1004=="PRT_2009"
*list A2037_1 C3011_E C3011_F if Z1004=="PRT_2009"
*tab A2037_1 if Z1004=="PRT_2009", miss

replace A2037_2 =0 if C3011_A< C3011_D & Z1004=="PRT_2009"
replace A2037_2 =1 if C3011_A> C3011_D & Z1004=="PRT_2009"
replace A2037_2 =0 if C3011_A == C3011_D & Z1004=="PRT_2009"
replace A2037_2 =0 if C3011_A ==. & Z1004=="PRT_2009"
replace A2037_2 =0 if C3011_D ==. & Z1004=="PRT_2009"
*list A2037_2 C3011_F C3011_B if Z1004=="PRT_2009"
*tab A2037_2 if Z1004=="PRT_2009", miss

replace A2037_3 =1 if C3011_A< C3011_B & Z1004=="PRT_2009"
replace A2037_3 =0 if C3011_A> C3011_B & Z1004=="PRT_2009"
replace A2037_3 =0 if C3011_A == C3011_B & Z1004=="PRT_2009"
replace A2037_3 =0 if C3011_A ==. & Z1004=="PRT_2009"
replace A2037_3 =0 if C3011_B ==. & Z1004=="PRT_2009"
*list A2037_3 C3011_B C3011_F if Z1004=="PRT_2009"
*tab A2037_3 if Z1004=="PRT_2009", miss

replace A2037_4 =1 if C3011_B< C3011_C & Z1004=="PRT_2009"
replace A2037_4 =0 if C3011_B> C3011_C & Z1004=="PRT_2009"
replace A2037_4 =0 if C3011_B == C3011_C & Z1004=="PRT_2009"
replace A2037_4 =0 if C3011_B ==. & Z1004=="PRT_2009"
replace A2037_4 =0 if C3011_C ==. & Z1004=="PRT_2009"
*list A2037_4 C3011_C C3011_H if Z1004=="PRT_2009"
*tab A2037_4 if Z1004=="PRT_2009"

replace A2037_5 =1 if C3011_D< C3011_C & Z1004=="PRT_2009"
replace A2037_5 =0 if C3011_D> C3011_C & Z1004=="PRT_2009"
replace A2037_5 =0 if C3011_D == C3011_C & Z1004=="PRT_2009"
replace A2037_5 =0 if C3011_D ==. & Z1004=="PRT_2009"
replace A2037_5 =0 if C3011_C ==. & Z1004=="PRT_2009"
*list A2037_5 C3011_D C3011_H if Z1004=="PRT_2009"
*tab A2037_5 if Z1004=="PRT_2009", miss


***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="PRT_2009"
*tab A2037 if Z1004=="PRT_2009"

*ii)correct placement of parties on the left-right is following the 
*5 parties
replace A2038_1 =0 if C3011_A<5 & Z1004=="PRT_2009"
replace A2038_1 =1 if C3011_A==5 & Z1004=="PRT_2009"
replace A2038_1 =0 if C3011_A>5  & Z1004=="PRT_2009"
replace A2038_1 =0 if C3011_A==.  & Z1004=="PRT_2009"
*tab A2038_1 if Z1004=="PRT_2009"

replace A2038_2 =1 if C3011_B>5 & Z1004=="PRT_2009"
replace A2038_2 =0 if C3011_B==5 & Z1004=="PRT_2009"
replace A2038_2 =0 if C3011_B<5  & Z1004=="PRT_2009"
replace A2038_2 =0 if C3011_B==.  & Z1004=="PRT_2009"
*list A2038_2 C3011_B if Z1004=="PRT_2009"
*tab A2038_2 if Z1004=="PRT_2009"

replace A2038_3 =1 if C3011_C>5 & Z1004=="PRT_2009"
replace A2038_3 =0 if C3011_C==5 & Z1004=="PRT_2009"
replace A2038_3 =0 if C3011_C<5  & Z1004=="PRT_2009"
replace A2038_3 =0 if C3011_C==.  & Z1004=="PRT_2009"
*tab A2038_3 if Z1004=="PRT_2009"
*list C3011_C A2038_3 if Z1004=="PRT_2009"

replace A2038_4 =1 if C3011_D<5 & Z1004=="PRT_2009"
replace A2038_4 =0 if C3011_D==5 & Z1004=="PRT_2009"
replace A2038_4 =0 if C3011_D>5  & Z1004=="PRT_2009"
replace A2038_4 =0 if C3011_D==.  & Z1004=="PRT_2009"
*list C3011_D A2038_4 if Z1004=="PRT_2009"
*tab A2038_4 if Z1004=="PRT_2009"

replace A2038_5 =1 if C3011_E<5 & Z1004=="PRT_2009"
replace A2038_5 =0 if C3011_E==5 & Z1004=="PRT_2009"
replace A2038_5 =0 if C3011_E>5  & Z1004=="PRT_2009"
replace A2038_5 =0 if C3011_E==.  & Z1004=="PRT_2009"
*list C3011_E A2038_4 if Z1004=="PRT_2009"
*tab A2038_5 if Z1004=="PRT_2009"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="PRT_2009"
*tab A2038 if Z1004=="PRT_2009"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="PRT_2009"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="PRT_2009"
*tab  A2039_1 if Z1004=="PRT_2009"
***missings
sum C3011_A if Z1004=="PRT_2009"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="PRT_2009"
replace A2039_1_b= C5017_A-(5.01+2.5) if C3011_A==. & Z1004=="PRT_2009"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="PRT_2009"
*tab  A2039_1_b if Z1004=="PRT_2009"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="PRT_2009"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="PRT_2009"
*tab  A2039_2 if Z1004=="PRT_2009"
***missings
sum C3011_B if Z1004=="PRT_2009"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="PRT_2009"
replace A2039_2_b= C5017_B-(6.96+2.28) if C3011_B==. & Z1004=="PRT_2009"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="PRT_2009"
*tab  A2039_2_b if Z1004=="PRT_2009"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="PRT_2009"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="PRT_2009"
*tab  A2039_3 if Z1004=="PRT_2009"
***missings
sum C3011_C if Z1004=="PRT_2009"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="PRT_2009"
replace A2039_3_b= C5017_C-(6.47+2.71) if C3011_C==. & Z1004=="PRT_2009"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="PRT_2009"
*tab  A2039_3_b if Z1004=="PRT_2009"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="PRT_2009"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="PRT_2009"
*tab  A2039_4 if Z1004=="PRT_2009"
***missings
sum C3011_E if Z1004=="PRT_2009"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="PRT_2009"
replace A2039_4_b= C5017_E-(2.59+2.22) if C3011_E==. & Z1004=="PRT_2009"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="PRT_2009"
*tab  A2039_4_b if Z1004=="PRT_2009"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="PRT_2009"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="PRT_2009"
*tab  A2039_5 if Z1004=="PRT_2009"
***missings
sum C3011_D if Z1004=="PRT_2009"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="PRT_2009"
replace A2039_5_b= C5017_D-(2.1+2.16) if C3011_D==. & Z1004=="PRT_2009"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="PRT_2009"
*tab  A2039_5_b if Z1004=="PRT_2009"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5)/5 if Z1004=="PRT_2009"
sum A2039 if Z1004=="PRT_2009"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b)/5 if Z1004=="PRT_2009"
sum  A2039_B if Z1004=="PRT_2009"

****************************************************************************************
***rom 2009
***MASSIVE DONT KNOWS
sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="ROM_2009" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="ROM_2009" 

*tab C3011_A if Z1004=="ROM_2009", mis
*tab C3011_B if Z1004=="ROM_2009", mis
*tab C3011_C if Z1004=="ROM_2009", mis
*tab C3011_D if Z1004=="ROM_2009", mis
*tab C3011_E if Z1004=="ROM_2009", mis
*tab C3011_F if Z1004=="ROM_2009", mis
*tab C3011_G if Z1004=="ROM_2009", mis
*tab C3011_H if Z1004=="ROM_2009", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="ROM_2009"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="ROM_2009"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="ROM_2009"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="ROM_2009"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="ROM_2009"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="ROM_2009"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="ROM_2009"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="ROM_2009"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="ROM_2009"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*5 parties 
** DBCAG
replace A2037_1 =1 if C3011_D< C3011_B & Z1004=="ROM_2009"
replace A2037_1 =0 if C3011_D> C3011_B & Z1004=="ROM_2009"
replace A2037_1 =0 if C3011_D == C3011_B & Z1004=="ROM_2009"
replace A2037_1 =0 if C3011_D ==. & Z1004=="ROM_2009"
replace A2037_1 =0 if C3011_B ==. & Z1004=="ROM_2009"
*list A2037_1 C3011_E C3011_F if Z1004=="ROM_2009"
*tab A2037_1 if Z1004=="ROM_2009", miss

replace A2037_2 =0 if C3011_B< C3011_C & Z1004=="ROM_2009"
replace A2037_2 =0 if C3011_B> C3011_C & Z1004=="ROM_2009"
replace A2037_2 =1 if C3011_B == C3011_C & Z1004=="ROM_2009"
replace A2037_2 =0 if C3011_B ==. & Z1004=="ROM_2009"
replace A2037_2 =0 if C3011_B ==. & Z1004=="ROM_2009"
*list A2037_2 C3011_F C3011_B if Z1004=="ROM_2009"
*tab A2037_2 if Z1004=="ROM_2009", miss

replace A2037_3 =1 if C3011_C< C3011_A & Z1004=="ROM_2009"
replace A2037_3 =0 if C3011_C> C3011_A & Z1004=="ROM_2009"
replace A2037_3 =0 if C3011_C == C3011_A & Z1004=="ROM_2009"
replace A2037_3 =0 if C3011_C ==. & Z1004=="ROM_2009"
replace A2037_3 =0 if C3011_A ==. & Z1004=="ROM_2009"
*list A2037_3 C3011_B C3011_F if Z1004=="ROM_2009"
*tab A2037_3 if Z1004=="ROM_2009", miss

replace A2037_4 =0 if C3011_G< C3011_A & Z1004=="ROM_2009"
replace A2037_4 =1 if C3011_G> C3011_A & Z1004=="ROM_2009"
replace A2037_4 =0 if C3011_G == C3011_A & Z1004=="ROM_2009"
replace A2037_4 =0 if C3011_G ==. & Z1004=="ROM_2009"
replace A2037_4 =0 if C3011_A ==. & Z1004=="ROM_2009"
*list A2037_4 C3011_C C3011_H if Z1004=="ROM_2009"
*tab A2037_4 if Z1004=="ROM_2009"

replace A2037_5 =1 if C3011_D< C3011_G & Z1004=="ROM_2009"
replace A2037_5 =0 if C3011_D> C3011_G & Z1004=="ROM_2009"
replace A2037_5 =0 if C3011_D == C3011_G & Z1004=="ROM_2009"
replace A2037_5 =0 if C3011_D ==. & Z1004=="ROM_2009"
replace A2037_5 =0 if C3011_G ==. & Z1004=="ROM_2009"
*list A2037_5 C3011_D C3011_G if Z1004=="ROM_2009"
*tab A2037_5 if Z1004=="ROM_2009", miss

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="ROM_2009"
*tab A2037 if Z1004=="ROM_2009"

*ii)correct placement of parties on the left-right is following the 
*5 parties
replace A2038_1 =0 if C3011_A<5 & Z1004=="ROM_2009"
replace A2038_1 =0 if C3011_A==5 & Z1004=="ROM_2009"
replace A2038_1 =1 if C3011_A>5  & Z1004=="ROM_2009"
replace A2038_1 =0 if C3011_A==.  & Z1004=="ROM_2009"
*tab A2038_1 if Z1004=="ROM_2009"

replace A2038_2 =0 if C3011_B>5 & Z1004=="ROM_2009"
replace A2038_2 =1 if C3011_B==5 & Z1004=="ROM_2009"
replace A2038_2 =0 if C3011_B<5  & Z1004=="ROM_2009"
replace A2038_2 =0 if C3011_B==.  & Z1004=="ROM_2009"
*list A2038_2 C3011_B if Z1004=="ROM_2009"
*tab A2038_2 if Z1004=="ROM_2009"

replace A2038_3 =0 if C3011_C>5 & Z1004=="ROM_2009"
replace A2038_3 =1 if C3011_C==5 & Z1004=="ROM_2009"
replace A2038_3 =0 if C3011_C<5  & Z1004=="ROM_2009"
replace A2038_3 =0 if C3011_C==.  & Z1004=="ROM_2009"
*tab A2038_3 if Z1004=="ROM_2009"
*list C3011_C A2038_3 if Z1004=="ROM_2009"

replace A2038_4 =1 if C3011_D<5 & Z1004=="ROM_2009"
replace A2038_4 =0 if C3011_D==5 & Z1004=="ROM_2009"
replace A2038_4 =0 if C3011_D>5  & Z1004=="ROM_2009"
replace A2038_4 =0 if C3011_D==.  & Z1004=="ROM_2009"
*list C3011_D A2038_4 if Z1004=="ROM_2009"
*tab A2038_4 if Z1004=="ROM_2009"


replace A2038_7 =0 if C3011_G<5 & Z1004=="ROM_2009"
replace A2038_7 =0 if C3011_G==5 & Z1004=="ROM_2009"
replace A2038_7 =1 if C3011_G>5  & Z1004=="ROM_2009"
replace A2038_7 =0 if C3011_G==.  & Z1004=="ROM_2009"
*list C3011_G A2038_7 if Z1004=="ROM_2009"
*tab A2038_7 if Z1004=="ROM_2009"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_7)/5 if Z1004=="ROM_2009"
*tab A2038 if Z1004=="ROM_2009"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="ROM_2009"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="ROM_2009"
*tab  A2039_1 if Z1004=="ROM_2009"
***missings
sum C3011_A if Z1004=="ROM_2009"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="ROM_2009"
replace A2039_1_b= C5017_A-(7.17+2.48) if C3011_A==. & Z1004=="ROM_2009"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="ROM_2009"
*tab  A2039_1_b if Z1004=="ROM_2009"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="ROM_2009"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="ROM_2009"
*tab  A2039_2 if Z1004=="ROM_2009"
***missings
sum C3011_B if Z1004=="ROM_2009"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="ROM_2009"
replace A2039_2_b= C5017_B-(2.6+2.82) if C3011_B==. & Z1004=="ROM_2009"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="ROM_2009"
*tab  A2039_2_b if Z1004=="ROM_2009"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="ROM_2009"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="ROM_2009"
*tab  A2039_3 if Z1004=="ROM_2009"
***missings
sum C3011_C if Z1004=="ROM_2009"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="ROM_2009"
replace A2039_3_b= C5017_C-(6.60+2.87) if C3011_C==. & Z1004=="ROM_2009"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="ROM_2009"
*tab  A2039_3_b if Z1004=="ROM_2009"


**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="ROM_2009"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="ROM_2009"
*tab  A2039_5 if Z1004=="ROM_2009"
***missings
sum C3011_D if Z1004=="ROM_2009"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="ROM_2009"
replace A2039_5_b= C5017_D-(3.19+2.71) if C3011_D==. & Z1004=="ROM_2009"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="ROM_2009"
*tab  A2039_5_b if Z1004=="ROM_2009"

*Party G
replace A2039_7 = C5017_G-C3011_G if Z1004=="ROM_2009"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="ROM_2009"
*tab  A2039_7 if Z1004=="ROM_2009"
***missings
sum C3011_G if Z1004=="ROM_2009"
replace A2039_7_b = C5017_G-C3011_G if Z1004=="ROM_2009"
replace A2039_7_b= C5017_G-(3.53+2.72) if C3011_G==. & Z1004=="ROM_2009"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="ROM_2009"
*tab  A2039_7_b if Z1004=="ROM_2009"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_5+A2039_7)/5 if Z1004=="ROM_2009"
sum A2039 if Z1004=="ROM_2009"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_5_b+A2039_7_b)/5 if Z1004=="ROM_2009"
sum  A2039_B if Z1004=="ROM_2009"

****************************************************************************************
sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H C5017_I if Z1004=="SWE_2006" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H C5017_I if Z1004=="SWE_2006" 

*tab C3011_A if Z1004=="SWE_2006", mis
*tab C3011_B if Z1004=="SWE_2006", mis
*tab C3011_C if Z1004=="SWE_2006", mis
*tab C3011_D if Z1004=="SWE_2006", mis
*tab C3011_E if Z1004=="SWE_2006", mis
*tab C3011_F if Z1004=="SWE_2006", mis
*tab C3011_G if Z1004=="SWE_2006", mis
*tab C3011_H if Z1004=="SWE_2006", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="SWE_2006"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="SWE_2006"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="SWE_2006"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="SWE_2006"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="SWE_2006"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="SWE_2006"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="SWE_2006"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="SWE_2006"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="SWE_2006"

***problem with sample that did not get CSES part. 408 respondents.
drop if C1007==3 & Z1004=="SWE_2006"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*7 parties 
** FAGCDEB
replace A2037_1 =1 if C3011_F< C3011_A & Z1004=="SWE_2006"
replace A2037_1 =0 if C3011_F> C3011_A & Z1004=="SWE_2006"
replace A2037_1 =0 if C3011_F == C3011_A & Z1004=="SWE_2006"
replace A2037_1 =0 if C3011_F ==. & Z1004=="SWE_2006"
replace A2037_1 =0 if C3011_A ==. & Z1004=="SWE_2006"
*list A2037_1 C3011_E C3011_F if Z1004=="SWE_2006"
*tab A2037_1 if Z1004=="SWE_2006", miss

replace A2037_2 =0 if C3011_A< C3011_G & Z1004=="SWE_2006"
replace A2037_2 =0 if C3011_A> C3011_G & Z1004=="SWE_2006"
replace A2037_2 =1 if C3011_A == C3011_G & Z1004=="SWE_2006"
replace A2037_2 =0 if C3011_A ==. & Z1004=="SWE_2006"
replace A2037_2 =0 if C3011_G ==. & Z1004=="SWE_2006"
*list A2037_2 C3011_F C3011_B if Z1004=="SWE_2006"
*tab A2037_2 if Z1004=="SWE_2006", miss

replace A2037_3 =1 if C3011_A< C3011_C & Z1004=="SWE_2006"
replace A2037_3 =0 if C3011_A> C3011_C & Z1004=="SWE_2006"
replace A2037_3 =0 if C3011_A == C3011_C & Z1004=="SWE_2006"
replace A2037_3 =0 if C3011_A ==. & Z1004=="SWE_2006"
replace A2037_3 =0 if C3011_C ==. & Z1004=="SWE_2006"
*list A2037_3 C3011_B C3011_F if Z1004=="SWE_2006"
*tab A2037_3 if Z1004=="SWE_2006", miss

replace A2037_4 =1 if C3011_C< C3011_D & Z1004=="SWE_2006"
replace A2037_4 =0 if C3011_C> C3011_D & Z1004=="SWE_2006"
replace A2037_4 =0 if C3011_C == C3011_D & Z1004=="SWE_2006"
replace A2037_4 =0 if C3011_C ==. & Z1004=="SWE_2006"
replace A2037_4 =0 if C3011_D ==. & Z1004=="SWE_2006"
*list A2037_4 C3011_C C3011_H if Z1004=="SWE_2006"
*tab A2037_4 if Z1004=="SWE_2006"

replace A2037_5 =0 if C3011_D< C3011_E & Z1004=="SWE_2006"
replace A2037_5 =0 if C3011_D> C3011_E & Z1004=="SWE_2006"
replace A2037_5 =1 if C3011_D == C3011_E & Z1004=="SWE_2006"
replace A2037_5 =0 if C3011_D ==. & Z1004=="SWE_2006"
replace A2037_5 =0 if C3011_E ==. & Z1004=="SWE_2006"
*list A2037_5 C3011_D C3011_H if Z1004=="SWE_2006"
*tab A2037_5 if Z1004=="SWE_2006", miss

replace A2037_6 =0 if C3011_B< C3011_E & Z1004=="SWE_2006"
replace A2037_6 =1 if C3011_B> C3011_E & Z1004=="SWE_2006"
replace A2037_6 =0 if C3011_B == C3011_E & Z1004=="SWE_2006"
replace A2037_6 =0 if C3011_B ==. & Z1004=="SWE_2006"
replace A2037_6 =0 if C3011_E ==. & Z1004=="SWE_2006"
*list A2037_6 C3011_D C3011_A if Z1004=="SWE_2006"
*tab A2037_6 if Z1004=="SWE_2006", miss

replace A2037_7 =0 if C3011_B< C3011_F & Z1004=="SWE_2006"
replace A2037_7 =1 if C3011_B> C3011_F & Z1004=="SWE_2006"
replace A2037_7 =0 if C3011_B == C3011_F & Z1004=="SWE_2006"
replace A2037_7 =0 if C3011_B ==. & Z1004=="SWE_2006"
replace A2037_7 =0 if C3011_F ==. & Z1004=="SWE_2006"
*list A2037_7 C3011_F C3011_G if Z1004=="SWE_2006"
*tab A2037_7 if Z1004=="SWE_2006", miss


***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7)/7 if Z1004=="SWE_2006"
*tab A2037 if Z1004=="SWE_2006"

*ii)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =1 if C3011_A<5 & Z1004=="SWE_2006"
replace A2038_1 =0 if C3011_A==5 & Z1004=="SWE_2006"
replace A2038_1 =0 if C3011_A>5  & Z1004=="SWE_2006"
replace A2038_1 =0 if C3011_A==.  & Z1004=="SWE_2006"
*tab A2038_1 if Z1004=="SWE_2006"

replace A2038_2 =1 if C3011_B>5 & Z1004=="SWE_2006"
replace A2038_2 =0 if C3011_B==5 & Z1004=="SWE_2006"
replace A2038_2 =0 if C3011_B<5  & Z1004=="SWE_2006"
replace A2038_2 =0 if C3011_B==.  & Z1004=="SWE_2006"
*list A2038_2 C3011_B if Z1004=="SWE_2006"
*tab A2038_2 if Z1004=="SWE_2006"

replace A2038_3 =1 if C3011_C>5 & Z1004=="SWE_2006"
replace A2038_3 =0 if C3011_C==5 & Z1004=="SWE_2006"
replace A2038_3 =0 if C3011_C<5  & Z1004=="SWE_2006"
replace A2038_3 =0 if C3011_C==.  & Z1004=="SWE_2006"
*tab A2038_3 if Z1004=="SWE_2006"
*list C3011_C A2038_3 if Z1004=="SWE_2006"

replace A2038_4 =0 if C3011_D<5 & Z1004=="SWE_2006"
replace A2038_4 =0 if C3011_D==5 & Z1004=="SWE_2006"
replace A2038_4 =1 if C3011_D>5  & Z1004=="SWE_2006"
replace A2038_4 =0 if C3011_D==.  & Z1004=="SWE_2006"
*list C3011_D A2038_4 if Z1004=="SWE_2006"
*tab A2038_4 if Z1004=="SWE_2006"

replace A2038_5 =0 if C3011_E<5 & Z1004=="SWE_2006"
replace A2038_5 =0 if C3011_E==5 & Z1004=="SWE_2006"
replace A2038_5 =1 if C3011_E>5  & Z1004=="SWE_2006"
replace A2038_5 =0 if C3011_E==.  & Z1004=="SWE_2006"
*list C3011_E A2038_4 if Z1004=="SWE_2006"
*tab A2038_5 if Z1004=="SWE_2006"

replace A2038_6 =0 if C3011_F>5 & Z1004=="SWE_2006"
replace A2038_6 =0 if C3011_F==5 & Z1004=="SWE_2006"
replace A2038_6 =1 if C3011_F<5  & Z1004=="SWE_2006"
replace A2038_6 =0 if C3011_F==.  & Z1004=="SWE_2006"
*list C3011_H A2038_5 if Z1004=="SWE_2006"
*tab A2038_6 if Z1004=="SWE_2006"

replace A2038_7 =1 if C3011_G<5 & Z1004=="SWE_2006"
replace A2038_7 =0 if C3011_G==5 & Z1004=="SWE_2006"
replace A2038_7 =0 if C3011_G>5  & Z1004=="SWE_2006"
replace A2038_7 =0 if C3011_G==.  & Z1004=="SWE_2006"
*list C3011_G A2038_7 if Z1004=="SWE_2006"
*tab A2038_7 if Z1004=="SWE_2006"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7)/7 if Z1004=="SWE_2006"
*tab A2038 if Z1004=="SWE_2006"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="SWE_2006"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="SWE_2006"
*tab  A2039_1 if Z1004=="SWE_2006"
***missings
sum C3011_A if Z1004=="SWE_2006"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="SWE_2006"
replace A2039_1_b= C5017_A-(3.55+1.77) if C3011_A==. & Z1004=="SWE_2006"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="SWE_2006"
*tab  A2039_1_b if Z1004=="SWE_2006"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="SWE_2006"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="SWE_2006"
*tab  A2039_2 if Z1004=="SWE_2006"
***missings
sum C3011_B if Z1004=="SWE_2006"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="SWE_2006"
replace A2039_2_b= C5017_B-(8.5+1.55) if C3011_B==. & Z1004=="SWE_2006"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="SWE_2006"
*tab  A2039_2_b if Z1004=="SWE_2006"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="SWE_2006"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="SWE_2006"
*tab  A2039_3 if Z1004=="SWE_2006"
***missings
sum C3011_C if Z1004=="SWE_2006"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="SWE_2006"
replace A2039_3_b= C5017_C-(6.25+1.38) if C3011_C==. & Z1004=="SWE_2006"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="SWE_2006"
*tab  A2039_3_b if Z1004=="SWE_2006"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="SWE_2006"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="SWE_2006"
*tab  A2039_4 if Z1004=="SWE_2006"
***missings
sum C3011_E if Z1004=="SWE_2006"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="SWE_2006"
replace A2039_4_b= C5017_E-(6.9+1.74) if C3011_E==. & Z1004=="SWE_2006"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="SWE_2006"
*tab  A2039_4_b if Z1004=="SWE_2006"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="SWE_2006"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="SWE_2006"
*tab  A2039_5 if Z1004=="SWE_2006"
***missings
sum C3011_D if Z1004=="SWE_2006"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="SWE_2006"
replace A2039_5_b= C5017_D-(6.75+1.43) if C3011_D==. & Z1004=="SWE_2006"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="SWE_2006"
*tab  A2039_5_b if Z1004=="SWE_2006"

*Party F
replace A2039_6 = C5017_F-C3011_F if Z1004=="SWE_2006"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="SWE_2006"
*tab  A2039_6 if Z1004=="SWE_2006"
***missings
sum C3011_F if Z1004=="SWE_2006"
replace A2039_6_b = C5017_F-C3011_F if Z1004=="SWE_2006"
replace A2039_6_b= C5017_F-(1.34+1.35) if C3011_F==. & Z1004=="SWE_2006"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="SWE_2006"
*tab  A2039_6_b if Z1004=="SWE_2006"

*Party G
replace A2039_7 = C5017_G-C3011_G if Z1004=="SWE_2006"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="SWE_2006"
*tab  A2039_7 if Z1004=="SWE_2006"
***missings
sum C3011_G if Z1004=="SWE_2006"
replace A2039_7_b = C5017_G-C3011_G if Z1004=="SWE_2006"
replace A2039_7_b= C5017_G-(3.54+1.52) if C3011_G==. & Z1004=="SWE_2006"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="SWE_2006"
*tab  A2039_7_b if Z1004=="SWE_2006"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7)/7 if Z1004=="SWE_2006"
sum A2039 if Z1004=="SWE_2006"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b)/7 if Z1004=="SWE_2006"
sum  A2039_B if Z1004=="SWE_2006"

****************************************************************************************
***MEX_2006
sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="CHE_2007" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="CHE_2007" 

****AFTER PART E, PARTIES HAVE WAY TOO MANY MISSINGS, 2/3 OF SAMPLE. i AM DROPPING THESE.

*tab C3011_A if Z1004=="CHE_2007", mis
*tab C3011_B if Z1004=="CHE_2007", mis
*tab C3011_C if Z1004=="CHE_2007", mis
*tab C3011_D if Z1004=="CHE_2007", mis
*tab C3011_E if Z1004=="CHE_2007", mis
*tab C3011_F if Z1004=="CHE_2007", mis
*tab C3011_G if Z1004=="CHE_2007", mis
*tab C3011_H if Z1004=="CHE_2007", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="CHE_2007"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="CHE_2007"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="CHE_2007"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="CHE_2007"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="CHE_2007"



**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*5 parties 
** EBDCA
replace A2037_1 =1 if C3011_E< C3011_B & Z1004=="CHE_2007"
replace A2037_1 =0 if C3011_E> C3011_B & Z1004=="CHE_2007"
replace A2037_1 =0 if C3011_E == C3011_B & Z1004=="CHE_2007"
replace A2037_1 =0 if C3011_E ==. & Z1004=="CHE_2007"
replace A2037_1 =0 if C3011_B ==. & Z1004=="CHE_2007"
*list A2037_1 C3011_E C3011_F if Z1004=="CHE_2007"
*tab A2037_1 if Z1004=="CHE_2007", miss

replace A2037_2 =1 if C3011_B< C3011_D & Z1004=="CHE_2007"
replace A2037_2 =0 if C3011_B> C3011_D & Z1004=="CHE_2007"
replace A2037_2 =0 if C3011_B == C3011_D & Z1004=="CHE_2007"
replace A2037_2 =0 if C3011_B ==. & Z1004=="CHE_2007"
replace A2037_2 =0 if C3011_D ==. & Z1004=="CHE_2007"
*list A2037_2 C3011_F C3011_B if Z1004=="CHE_2007"
*tab A2037_2 if Z1004=="CHE_2007", miss

replace A2037_3 =1 if C3011_D< C3011_C & Z1004=="CHE_2007"
replace A2037_3 =0 if C3011_D> C3011_C & Z1004=="CHE_2007"
replace A2037_3 =0 if C3011_D == C3011_C & Z1004=="CHE_2007"
replace A2037_3 =0 if C3011_D ==. & Z1004=="CHE_2007"
replace A2037_3 =0 if C3011_C ==. & Z1004=="CHE_2007"
*list A2037_3 C3011_B C3011_F if Z1004=="CHE_2007"
*tab A2037_3 if Z1004=="CHE_2007", miss

replace A2037_4 =1 if C3011_C< C3011_A & Z1004=="CHE_2007"
replace A2037_4 =0 if C3011_C> C3011_A & Z1004=="CHE_2007"
replace A2037_4 =0 if C3011_C == C3011_A & Z1004=="CHE_2007"
replace A2037_4 =0 if C3011_C ==. & Z1004=="CHE_2007"
replace A2037_4 =0 if C3011_A ==. & Z1004=="CHE_2007"
*list A2037_4 C3011_C C3011_H if Z1004=="CHE_2007"
*tab A2037_4 if Z1004=="CHE_2007"

replace A2037_5 =1 if C3011_E< C3011_A & Z1004=="CHE_2007"
replace A2037_5 =0 if C3011_E> C3011_A & Z1004=="CHE_2007"
replace A2037_5 =0 if C3011_E == C3011_A & Z1004=="CHE_2007"
replace A2037_5 =0 if C3011_E ==. & Z1004=="CHE_2007"
replace A2037_5 =0 if C3011_A ==. & Z1004=="CHE_2007"
*list A2037_5 C3011_D C3011_H if Z1004=="CHE_2007"
*tab A2037_5 if Z1004=="CHE_2007", miss


***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5)/5 if Z1004=="CHE_2007"
*tab A2037 if Z1004=="CHE_2007"

*ii)correct placement of parties on the left-right is following the 
*5 parties
replace A2038_1 =0 if C3011_A<5 & Z1004=="CHE_2007"
replace A2038_1 =0 if C3011_A==5 & Z1004=="CHE_2007"
replace A2038_1 =1 if C3011_A>5  & Z1004=="CHE_2007"
replace A2038_1 =0 if C3011_A==.  & Z1004=="CHE_2007"
*tab A2038_1 if Z1004=="CHE_2007"

replace A2038_2 =0 if C3011_B>5 & Z1004=="CHE_2007"
replace A2038_2 =0 if C3011_B==5 & Z1004=="CHE_2007"
replace A2038_2 =1 if C3011_B<5  & Z1004=="CHE_2007"
replace A2038_2 =0 if C3011_B==.  & Z1004=="CHE_2007"
*list A2038_2 C3011_B if Z1004=="CHE_2007"
*tab A2038_2 if Z1004=="CHE_2007"

replace A2038_3 =1 if C3011_C>5 & Z1004=="CHE_2007"
replace A2038_3 =0 if C3011_C==5 & Z1004=="CHE_2007"
replace A2038_3 =0 if C3011_C<5  & Z1004=="CHE_2007"
replace A2038_3 =0 if C3011_C==.  & Z1004=="CHE_2007"
*tab A2038_3 if Z1004=="CHE_2007"
*list C3011_C A2038_3 if Z1004=="CHE_2007"

replace A2038_4 =0 if C3011_D<5 & Z1004=="CHE_2007"
replace A2038_4 =0 if C3011_D==5 & Z1004=="CHE_2007"
replace A2038_4 =1 if C3011_D>5  & Z1004=="CHE_2007"
replace A2038_4 =0 if C3011_D==.  & Z1004=="CHE_2007"
*list C3011_D A2038_4 if Z1004=="CHE_2007"
*tab A2038_4 if Z1004=="CHE_2007"

replace A2038_5 =1 if C3011_E<5 & Z1004=="CHE_2007"
replace A2038_5 =0 if C3011_E==5 & Z1004=="CHE_2007"
replace A2038_5 =0 if C3011_E>5  & Z1004=="CHE_2007"
replace A2038_5 =0 if C3011_E==.  & Z1004=="CHE_2007"
*list C3011_E A2038_4 if Z1004=="CHE_2007"
*tab A2038_5 if Z1004=="CHE_2007"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5)/5 if Z1004=="CHE_2007"
*tab A2038 if Z1004=="CHE_2007"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="CHE_2007"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="CHE_2007"
*tab  A2039_1 if Z1004=="CHE_2007"
***missings
sum C3011_A if Z1004=="CHE_2007"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="CHE_2007"
replace A2039_1_b= C5017_A-(8.11+2.41) if C3011_A==. & Z1004=="CHE_2007"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="CHE_2007"
*tab  A2039_1_b if Z1004=="CHE_2007"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="CHE_2007"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="CHE_2007"
*tab  A2039_2 if Z1004=="CHE_2007"
***missings
sum C3011_B if Z1004=="CHE_2007"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="CHE_2007"
replace A2039_2_b= C5017_B-(2.86+2.17) if C3011_B==. & Z1004=="CHE_2007"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="CHE_2007"
*tab  A2039_2_b if Z1004=="CHE_2007"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="CHE_2007"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="CHE_2007"
*tab  A2039_3 if Z1004=="CHE_2007"
***missings
sum C3011_C if Z1004=="CHE_2007"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="CHE_2007"
replace A2039_3_b= C5017_C-(6.11+1.87) if C3011_C==. & Z1004=="CHE_2007"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="CHE_2007"
*tab  A2039_3_b if Z1004=="CHE_2007"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="CHE_2007"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="CHE_2007"
*tab  A2039_4 if Z1004=="CHE_2007"
***missings
sum C3011_E if Z1004=="CHE_2007"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="CHE_2007"
replace A2039_4_b= C5017_E-(3.02+2.11) if C3011_E==. & Z1004=="CHE_2007"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="CHE_2007"
*tab  A2039_4_b if Z1004=="CHE_2007"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="CHE_2007"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="CHE_2007"
*tab  A2039_5 if Z1004=="CHE_2007"
***missings
sum C3011_D if Z1004=="CHE_2007"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="CHE_2007"
replace A2039_5_b= C5017_D-(5.35+1.68) if C3011_D==. & Z1004=="CHE_2007"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="CHE_2007"
*tab  A2039_5_b if Z1004=="CHE_2007"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5)/5 if Z1004=="CHE_2007"
sum A2039 if Z1004=="CHE_2007"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b)/5 if Z1004=="CHE_2007"
sum  A2039_B if Z1004=="CHE_2007"

****************************************************************************************
sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="ESP_2008" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="ESP_2008" 

*tab C3011_A if Z1004=="ESP_2008", mis
*tab C3011_B if Z1004=="ESP_2008", mis
*tab C3011_C if Z1004=="ESP_2008", mis
*tab C3011_D if Z1004=="ESP_2008", mis
*tab C3011_E if Z1004=="ESP_2008", mis
*tab C3011_F if Z1004=="ESP_2008", mis
*tab C3011_G if Z1004=="ESP_2008", mis
*tab C3011_H if Z1004=="ESP_2008", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="ESP_2008"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="ESP_2008"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="ESP_2008"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="ESP_2008"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="ESP_2008"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="ESP_2008"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="ESP_2008"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="ESP_2008"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="ESP_2008"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*8 parties 
** EFGAHCDB
replace A2037_1 =0 if C3011_E< C3011_F & Z1004=="ESP_2008"
replace A2037_1 =0 if C3011_E> C3011_F & Z1004=="ESP_2008"
replace A2037_1 =1 if C3011_E == C3011_F & Z1004=="ESP_2008"
replace A2037_1 =0 if C3011_E ==. & Z1004=="ESP_2008"
replace A2037_1 =0 if C3011_F ==. & Z1004=="ESP_2008"
*list A2037_1 C3011_E C3011_F if Z1004=="ESP_2008"
*tab A2037_1 if Z1004=="ESP_2008", miss

replace A2037_2 =0 if C3011_F< C3011_G & Z1004=="ESP_2008"
replace A2037_2 =0 if C3011_F> C3011_G & Z1004=="ESP_2008"
replace A2037_2 =1 if C3011_F == C3011_G & Z1004=="ESP_2008"
replace A2037_2 =0 if C3011_F ==. & Z1004=="ESP_2008"
replace A2037_2 =0 if C3011_G ==. & Z1004=="ESP_2008"
*list A2037_2 C3011_F C3011_B if Z1004=="ESP_2008"
*tab A2037_2 if Z1004=="ESP_2008", miss

replace A2037_3 =1 if C3011_E< C3011_A & Z1004=="ESP_2008"
replace A2037_3 =0 if C3011_E> C3011_A & Z1004=="ESP_2008"
replace A2037_3 =0 if C3011_E == C3011_A & Z1004=="ESP_2008"
replace A2037_3 =0 if C3011_E ==. & Z1004=="ESP_2008"
replace A2037_3 =0 if C3011_A ==. & Z1004=="ESP_2008"
*list A2037_3 C3011_B C3011_F if Z1004=="ESP_2008"
*tab A2037_3 if Z1004=="ESP_2008", miss

replace A2037_4 =1 if C3011_A< C3011_H & Z1004=="ESP_2008"
replace A2037_4 =0 if C3011_A> C3011_H & Z1004=="ESP_2008"
replace A2037_4 =0 if C3011_A == C3011_H & Z1004=="ESP_2008"
replace A2037_4 =0 if C3011_A ==. & Z1004=="ESP_2008"
replace A2037_4 =0 if C3011_H ==. & Z1004=="ESP_2008"
*list A2037_4 C3011_C C3011_H if Z1004=="ESP_2008"
*tab A2037_4 if Z1004=="ESP_2008"

replace A2037_5 =1 if C3011_H< C3011_C & Z1004=="ESP_2008"
replace A2037_5 =0 if C3011_H> C3011_C & Z1004=="ESP_2008"
replace A2037_5 =0 if C3011_H == C3011_C & Z1004=="ESP_2008"
replace A2037_5 =0 if C3011_H ==. & Z1004=="ESP_2008"
replace A2037_5 =0 if C3011_C ==. & Z1004=="ESP_2008"
*list A2037_5 C3011_D C3011_H if Z1004=="ESP_2008"
*tab A2037_5 if Z1004=="ESP_2008", miss

replace A2037_6 =0 if C3011_C< C3011_D & Z1004=="ESP_2008"
replace A2037_6 =0 if C3011_C> C3011_D & Z1004=="ESP_2008"
replace A2037_6 =1 if C3011_C == C3011_D & Z1004=="ESP_2008"
replace A2037_6 =0 if C3011_C ==. & Z1004=="ESP_2008"
replace A2037_6 =0 if C3011_D ==. & Z1004=="ESP_2008"
*list A2037_6 C3011_D C3011_A if Z1004=="ESP_2008"
*tab A2037_6 if Z1004=="ESP_2008", miss

replace A2037_7 =0 if C3011_B< C3011_D & Z1004=="ESP_2008"
replace A2037_7 =1 if C3011_B> C3011_D & Z1004=="ESP_2008"
replace A2037_7 =0 if C3011_B == C3011_D & Z1004=="ESP_2008"
replace A2037_7 =0 if C3011_B ==. & Z1004=="ESP_2008"
replace A2037_7 =0 if C3011_D ==. & Z1004=="ESP_2008"
*list A2037_7 C3011_F C3011_G if Z1004=="ESP_2008"
*tab A2037_7 if Z1004=="ESP_2008", miss

replace A2037_8 =1 if C3011_E< C3011_B & Z1004=="ESP_2008"
replace A2037_8 =0 if C3011_E> C3011_B & Z1004=="ESP_2008"
replace A2037_8 =0 if C3011_E == C3011_B & Z1004=="ESP_2008"
replace A2037_8 =0 if C3011_E ==. & Z1004=="ESP_2008"
replace A2037_8 =0 if C3011_B ==. & Z1004=="ESP_2008"
*list A2037_8 C3011_E C3011_G if Z1004=="ESP_2008"
*tab A2037_8 if Z1004=="ESP_2008", miss

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7+A2037_8)/8 if Z1004=="ESP_2008"
*tab A2037 if Z1004=="ESP_2008"

*ii)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =1 if C3011_A<5 & Z1004=="ESP_2008"
replace A2038_1 =0 if C3011_A==5 & Z1004=="ESP_2008"
replace A2038_1 =0 if C3011_A>5  & Z1004=="ESP_2008"
replace A2038_1 =0 if C3011_A==.  & Z1004=="ESP_2008"
*tab A2038_1 if Z1004=="ESP_2008"

replace A2038_2 =1 if C3011_B>5 & Z1004=="ESP_2008"
replace A2038_2 =0 if C3011_B==5 & Z1004=="ESP_2008"
replace A2038_2 =0 if C3011_B<5  & Z1004=="ESP_2008"
replace A2038_2 =0 if C3011_B==.  & Z1004=="ESP_2008"
*list A2038_2 C3011_B if Z1004=="ESP_2008"
*tab A2038_2 if Z1004=="ESP_2008"

replace A2038_3 =1 if C3011_C>5 & Z1004=="ESP_2008"
replace A2038_3 =0 if C3011_C==5 & Z1004=="ESP_2008"
replace A2038_3 =0 if C3011_C<5  & Z1004=="ESP_2008"
replace A2038_3 =0 if C3011_C==.  & Z1004=="ESP_2008"
*tab A2038_3 if Z1004=="ESP_2008"
*list C3011_C A2038_3 if Z1004=="ESP_2008"

replace A2038_4 =0 if C3011_D<5 & Z1004=="ESP_2008"
replace A2038_4 =0 if C3011_D==5 & Z1004=="ESP_2008"
replace A2038_4 =1 if C3011_D>5  & Z1004=="ESP_2008"
replace A2038_4 =0 if C3011_D==.  & Z1004=="ESP_2008"
*list C3011_D A2038_4 if Z1004=="ESP_2008"
*tab A2038_4 if Z1004=="ESP_2008"

replace A2038_5 =1 if C3011_E<5 & Z1004=="ESP_2008"
replace A2038_5 =0 if C3011_E==5 & Z1004=="ESP_2008"
replace A2038_5 =0 if C3011_E>5  & Z1004=="ESP_2008"
replace A2038_5 =0 if C3011_E==.  & Z1004=="ESP_2008"
*list C3011_E A2038_4 if Z1004=="ESP_2008"
*tab A2038_5 if Z1004=="ESP_2008"

replace A2038_6 =0 if C3011_F>5 & Z1004=="ESP_2008"
replace A2038_6 =0 if C3011_F==5 & Z1004=="ESP_2008"
replace A2038_6 =1 if C3011_F<5  & Z1004=="ESP_2008"
replace A2038_6 =0 if C3011_F==.  & Z1004=="ESP_2008"
*list C3011_H A2038_5 if Z1004=="ESP_2008"
*tab A2038_6 if Z1004=="ESP_2008"

replace A2038_7 =1 if C3011_G<5 & Z1004=="ESP_2008"
replace A2038_7 =0 if C3011_G==5 & Z1004=="ESP_2008"
replace A2038_7 =0 if C3011_G>5  & Z1004=="ESP_2008"
replace A2038_7 =0 if C3011_G==.  & Z1004=="ESP_2008"
*list C3011_G A2038_7 if Z1004=="ESP_2008"
*tab A2038_7 if Z1004=="ESP_2008"

replace A2038_8 =0 if C3011_H<5 & Z1004=="ESP_2008"
replace A2038_8 =1 if C3011_H==5 & Z1004=="ESP_2008"
replace A2038_8 =0 if C3011_H>5  & Z1004=="ESP_2008"
replace A2038_8 =0 if C3011_H==.  & Z1004=="ESP_2008"
*list C3011_H A2038_8 if Z1004=="ESP_2008"
*tab A2038_8 if Z1004=="ESP_2008"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7+A2038_8)/8 if Z1004=="ESP_2008"
*tab A2038 if Z1004=="ESP_2008"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="ESP_2008"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="ESP_2008"
*tab  A2039_1 if Z1004=="ESP_2008"
***missings
sum C3011_A if Z1004=="ESP_2008"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="ESP_2008"
replace A2039_1_b= C5017_A-(3.08+1.60) if C3011_A==. & Z1004=="ESP_2008"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="ESP_2008"
*tab  A2039_1_b if Z1004=="ESP_2008"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="ESP_2008"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="ESP_2008"
*tab  A2039_2 if Z1004=="ESP_2008"
***missings
sum C3011_B if Z1004=="ESP_2008"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="ESP_2008"
replace A2039_2_b= C5017_B-(7.74+1.66) if C3011_B==. & Z1004=="ESP_2008"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="ESP_2008"
*tab  A2039_2_b if Z1004=="ESP_2008"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="ESP_2008"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="ESP_2008"
*tab  A2039_3 if Z1004=="ESP_2008"
***missings
sum C3011_C if Z1004=="ESP_2008"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="ESP_2008"
replace A2039_3_b= C5017_C-(5.41+2.11) if C3011_C==. & Z1004=="ESP_2008"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="ESP_2008"
*tab  A2039_3_b if Z1004=="ESP_2008"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="ESP_2008"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="ESP_2008"
*tab  A2039_4 if Z1004=="ESP_2008"
***missings
sum C3011_E if Z1004=="ESP_2008"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="ESP_2008"
replace A2039_4_b= C5017_E-(1.99+2.16) if C3011_E==. & Z1004=="ESP_2008"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="ESP_2008"
*tab  A2039_4_b if Z1004=="ESP_2008"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="ESP_2008"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="ESP_2008"
*tab  A2039_5 if Z1004=="ESP_2008"
***missings
sum C3011_D if Z1004=="ESP_2008"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="ESP_2008"
replace A2039_5_b= C5017_D-(4.77+2.58) if C3011_D==. & Z1004=="ESP_2008"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="ESP_2008"
*tab  A2039_5_b if Z1004=="ESP_2008"

*Party F
replace A2039_6 = C5017_F-C3011_F if Z1004=="ESP_2008"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="ESP_2008"
*tab  A2039_6 if Z1004=="ESP_2008"
***missings
sum C3011_F if Z1004=="ESP_2008"
replace A2039_6_b = C5017_F-C3011_F if Z1004=="ESP_2008"
replace A2039_6_b= C5017_F-(1.61+1.54) if C3011_F==. & Z1004=="ESP_2008"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="ESP_2008"
*tab  A2039_6_b if Z1004=="ESP_2008"

*Party G
replace A2039_7 = C5017_G-C3011_G if Z1004=="ESP_2008"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="ESP_2008"
*tab  A2039_7 if Z1004=="ESP_2008"
***missings
sum C3011_G if Z1004=="ESP_2008"
replace A2039_7_b = C5017_G-C3011_G if Z1004=="ESP_2008"
replace A2039_7_b= C5017_G-(3.46+2.34) if C3011_G==. & Z1004=="ESP_2008"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="ESP_2008"
*tab  A2039_7_b if Z1004=="ESP_2008"

*Party H
replace A2039_8 = C5017_H-C3011_H if Z1004=="ESP_2008"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="ESP_2008"
*tab  A2039_8 if Z1004=="ESP_2008"
***missings
sum C3011_H if Z1004=="ESP_2008"
replace A2039_8_b = C5017_H-C3011_H if Z1004=="ESP_2008"
replace A2039_8_b= C5017_H-(5.04+2.03) if C3011_H==. & Z1004=="ESP_2008"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="ESP_2008"
*tab  A2039_8_b if Z1004=="ESP_2008"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7+A2039_8)/8 if Z1004=="ESP_2008"
sum A2039 if Z1004=="ESP_2008"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b+A2039_8_b)/8 if Z1004=="ESP_2008"
sum  A2039_B if Z1004=="ESP_2008"

****************************************************************************************
***MEX_2006
sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="MEX_2006" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="MEX_2006" 

*tab C3011_A if Z1004=="MEX_2006", mis
*tab C3011_B if Z1004=="MEX_2006", mis
*tab C3011_C if Z1004=="MEX_2006", mis
*tab C3011_D if Z1004=="MEX_2006", mis
*tab C3011_E if Z1004=="MEX_2006", mis
*tab C3011_F if Z1004=="MEX_2006", mis
*tab C3011_G if Z1004=="MEX_2006", mis
*tab C3011_H if Z1004=="MEX_2006", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2006"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2006"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2006"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2006"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2006"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2006"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2006"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2006"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2006"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*8 parties 
** EHBFCDGA
replace A2037_1 =0 if C3011_E< C3011_H & Z1004=="MEX_2006"
replace A2037_1 =0 if C3011_E> C3011_H & Z1004=="MEX_2006"
replace A2037_1 =1 if C3011_E == C3011_H & Z1004=="MEX_2006"
replace A2037_1 =0 if C3011_E ==. & Z1004=="MEX_2006"
replace A2037_1 =0 if C3011_H ==. & Z1004=="MEX_2006"
*list A2037_1 C3011_E C3011_F if Z1004=="MEX_2006"
*tab A2037_1 if Z1004=="MEX_2006", miss

replace A2037_2 =1 if C3011_E< C3011_B & Z1004=="MEX_2006"
replace A2037_2 =0 if C3011_E> C3011_B & Z1004=="MEX_2006"
replace A2037_2 =0 if C3011_E == C3011_B & Z1004=="MEX_2006"
replace A2037_2 =0 if C3011_E ==. & Z1004=="MEX_2006"
replace A2037_2 =0 if C3011_B ==. & Z1004=="MEX_2006"
*list A2037_2 C3011_F C3011_B if Z1004=="MEX_2006"
*tab A2037_2 if Z1004=="MEX_2006", miss

replace A2037_3 =0 if C3011_B< C3011_F & Z1004=="MEX_2006"
replace A2037_3 =0 if C3011_B> C3011_F & Z1004=="MEX_2006"
replace A2037_3 =1 if C3011_B == C3011_F & Z1004=="MEX_2006"
replace A2037_3 =0 if C3011_B ==. & Z1004=="MEX_2006"
replace A2037_3 =0 if C3011_F ==. & Z1004=="MEX_2006"
*list A2037_3 C3011_B C3011_F if Z1004=="MEX_2006"
*tab A2037_3 if Z1004=="MEX_2006", miss

replace A2037_4 =1 if C3011_B< C3011_C & Z1004=="MEX_2006"
replace A2037_4 =0 if C3011_B> C3011_C & Z1004=="MEX_2006"
replace A2037_4 =0 if C3011_B == C3011_C & Z1004=="MEX_2006"
replace A2037_4 =0 if C3011_B ==. & Z1004=="MEX_2006"
replace A2037_4 =0 if C3011_C ==. & Z1004=="MEX_2006"
*list A2037_4 C3011_C C3011_H if Z1004=="MEX_2006"
*tab A2037_4 if Z1004=="MEX_2006"

replace A2037_5 =0 if C3011_C< C3011_D & Z1004=="MEX_2006"
replace A2037_5 =1 if C3011_C> C3011_D & Z1004=="MEX_2006"
replace A2037_5 =0 if C3011_C == C3011_D & Z1004=="MEX_2006"
replace A2037_5 =0 if C3011_C ==. & Z1004=="MEX_2006"
replace A2037_5 =0 if C3011_D ==. & Z1004=="MEX_2006"
*list A2037_5 C3011_D C3011_H if Z1004=="MEX_2006"
*tab A2037_5 if Z1004=="MEX_2006", miss

replace A2037_6 =0 if C3011_D< C3011_G & Z1004=="MEX_2006"
replace A2037_6 =0 if C3011_D> C3011_G & Z1004=="MEX_2006"
replace A2037_6 =1 if C3011_D == C3011_G & Z1004=="MEX_2006"
replace A2037_6 =0 if C3011_D ==. & Z1004=="MEX_2006"
replace A2037_6 =0 if C3011_G ==. & Z1004=="MEX_2006"
*list A2037_6 C3011_D C3011_A if Z1004=="MEX_2006"
*tab A2037_6 if Z1004=="MEX_2006", miss

replace A2037_7 =1 if C3011_G< C3011_A & Z1004=="MEX_2006"
replace A2037_7 =0 if C3011_G> C3011_A & Z1004=="MEX_2006"
replace A2037_7 =0 if C3011_G == C3011_A & Z1004=="MEX_2006"
replace A2037_7 =0 if C3011_G ==. & Z1004=="MEX_2006"
replace A2037_7 =0 if C3011_A ==. & Z1004=="MEX_2006"
*list A2037_7 C3011_F C3011_G if Z1004=="MEX_2006"
*tab A2037_7 if Z1004=="MEX_2006", miss

replace A2037_8 =0 if C3011_A< C3011_E & Z1004=="MEX_2006"
replace A2037_8 =1 if C3011_A> C3011_E & Z1004=="MEX_2006"
replace A2037_8 =0 if C3011_A == C3011_E & Z1004=="MEX_2006"
replace A2037_8 =0 if C3011_A ==. & Z1004=="MEX_2006"
replace A2037_8 =0 if C3011_E ==. & Z1004=="MEX_2006"
*list A2037_8 C3011_E C3011_G if Z1004=="MEX_2006"
*tab A2037_8 if Z1004=="MEX_2006", miss

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7+A2037_8)/8 if Z1004=="MEX_2006"
*tab A2037 if Z1004=="MEX_2006"

*ii)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =0 if C3011_A<5 & Z1004=="MEX_2006"
replace A2038_1 =0 if C3011_A==5 & Z1004=="MEX_2006"
replace A2038_1 =1 if C3011_A>5  & Z1004=="MEX_2006"
replace A2038_1 =0 if C3011_A==.  & Z1004=="MEX_2006"
*tab A2038_1 if Z1004=="MEX_2006"

replace A2038_2 =0 if C3011_B>5 & Z1004=="MEX_2006"
replace A2038_2 =0 if C3011_B==5 & Z1004=="MEX_2006"
replace A2038_2 =1 if C3011_B<5  & Z1004=="MEX_2006"
replace A2038_2 =0 if C3011_B==.  & Z1004=="MEX_2006"
*list A2038_2 C3011_B if Z1004=="MEX_2006"
*tab A2038_2 if Z1004=="MEX_2006"

replace A2038_3 =0 if C3011_C>5 & Z1004=="MEX_2006"
replace A2038_3 =1 if C3011_C==5 & Z1004=="MEX_2006"
replace A2038_3 =0 if C3011_C<5  & Z1004=="MEX_2006"
replace A2038_3 =0 if C3011_C==.  & Z1004=="MEX_2006"
*tab A2038_3 if Z1004=="MEX_2006"
*list C3011_C A2038_3 if Z1004=="MEX_2006"

replace A2038_4 =0 if C3011_D<5 & Z1004=="MEX_2006"
replace A2038_4 =0 if C3011_D==5 & Z1004=="MEX_2006"
replace A2038_4 =1 if C3011_D>5  & Z1004=="MEX_2006"
replace A2038_4 =0 if C3011_D==.  & Z1004=="MEX_2006"
*list C3011_D A2038_4 if Z1004=="MEX_2006"
*tab A2038_4 if Z1004=="MEX_2006"

replace A2038_5 =1 if C3011_E<5 & Z1004=="MEX_2006"
replace A2038_5 =0 if C3011_E==5 & Z1004=="MEX_2006"
replace A2038_5 =0 if C3011_E>5  & Z1004=="MEX_2006"
replace A2038_5 =0 if C3011_E==.  & Z1004=="MEX_2006"
*list C3011_E A2038_4 if Z1004=="MEX_2006"
*tab A2038_5 if Z1004=="MEX_2006"

replace A2038_6 =0 if C3011_F>5 & Z1004=="MEX_2006"
replace A2038_6 =0 if C3011_F==5 & Z1004=="MEX_2006"
replace A2038_6 =1 if C3011_F<5  & Z1004=="MEX_2006"
replace A2038_6 =0 if C3011_F==.  & Z1004=="MEX_2006"
*list C3011_H A2038_5 if Z1004=="MEX_2006"
*tab A2038_6 if Z1004=="MEX_2006"

replace A2038_7 =0 if C3011_G<5 & Z1004=="MEX_2006"
replace A2038_7 =0 if C3011_G==5 & Z1004=="MEX_2006"
replace A2038_7 =1 if C3011_G>5  & Z1004=="MEX_2006"
replace A2038_7 =0 if C3011_G==.  & Z1004=="MEX_2006"
*list C3011_G A2038_7 if Z1004=="MEX_2006"
*tab A2038_7 if Z1004=="MEX_2006"

replace A2038_8 =1 if C3011_H<5 & Z1004=="MEX_2006"
replace A2038_8 =0 if C3011_H==5 & Z1004=="MEX_2006"
replace A2038_8 =0 if C3011_H>5  & Z1004=="MEX_2006"
replace A2038_8 =0 if C3011_H==.  & Z1004=="MEX_2006"
*list C3011_H A2038_8 if Z1004=="MEX_2006"
*tab A2038_8 if Z1004=="MEX_2006"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7+A2038_8)/8 if Z1004=="MEX_2006"
*tab A2038 if Z1004=="MEX_2006"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="MEX_2006"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="MEX_2006"
*tab  A2039_1 if Z1004=="MEX_2006"
***missings
sum C3011_A if Z1004=="MEX_2006"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="MEX_2006"
replace A2039_1_b= C5017_A-(7.11+3.37) if C3011_A==. & Z1004=="MEX_2006"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="MEX_2006"
*tab  A2039_1_b if Z1004=="MEX_2006"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="MEX_2006"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="MEX_2006"
*tab  A2039_2 if Z1004=="MEX_2006"
***missings
sum C3011_B if Z1004=="MEX_2006"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="MEX_2006"
replace A2039_2_b= C5017_B-(4.13+3.57) if C3011_B==. & Z1004=="MEX_2006"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="MEX_2006"
*tab  A2039_2_b if Z1004=="MEX_2006"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="MEX_2006"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="MEX_2006"
*tab  A2039_3 if Z1004=="MEX_2006"
***missings
sum C3011_C if Z1004=="MEX_2006"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="MEX_2006"
replace A2039_3_b= C5017_C-(5.27+3.6) if C3011_C==. & Z1004=="MEX_2006"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="MEX_2006"
*tab  A2039_3_b if Z1004=="MEX_2006"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="MEX_2006"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="MEX_2006"
*tab  A2039_4 if Z1004=="MEX_2006"
***missings
sum C3011_E if Z1004=="MEX_2006"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="MEX_2006"
replace A2039_4_b= C5017_E-(3.62+3.06) if C3011_E==. & Z1004=="MEX_2006"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="MEX_2006"
*tab  A2039_4_b if Z1004=="MEX_2006"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="MEX_2006"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="MEX_2006"
*tab  A2039_5 if Z1004=="MEX_2006"
***missings
sum C3011_D if Z1004=="MEX_2006"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="MEX_2006"
replace A2039_5_b= C5017_D-(5.5+3.24) if C3011_D==. & Z1004=="MEX_2006"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="MEX_2006"
*tab  A2039_5_b if Z1004=="MEX_2006"

*Party F
replace A2039_6 = C5017_F-C3011_F if Z1004=="MEX_2006"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="MEX_2006"
*tab  A2039_6 if Z1004=="MEX_2006"
***missings
sum C3011_F if Z1004=="MEX_2006"
replace A2039_6_b = C5017_F-C3011_F if Z1004=="MEX_2006"
replace A2039_6_b= C5017_F-(3.63+3.07) if C3011_F==. & Z1004=="MEX_2006"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="MEX_2006"
*tab  A2039_6_b if Z1004=="MEX_2006"

*Party G
replace A2039_7 = C5017_G-C3011_G if Z1004=="MEX_2006"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="MEX_2006"
*tab  A2039_7 if Z1004=="MEX_2006"
***missings
sum C3011_G if Z1004=="MEX_2006"
replace A2039_7_b = C5017_G-C3011_G if Z1004=="MEX_2006"
replace A2039_7_b= C5017_G-(3.94+3.18) if C3011_G==. & Z1004=="MEX_2006"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="MEX_2006"
*tab  A2039_7_b if Z1004=="MEX_2006"

*Party H
replace A2039_8 = C5017_H-C3011_H if Z1004=="MEX_2006"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="MEX_2006"
*tab  A2039_8 if Z1004=="MEX_2006"
***missings
sum C3011_H if Z1004=="MEX_2006"
replace A2039_8_b = C5017_H-C3011_H if Z1004=="MEX_2006"
replace A2039_8_b= C5017_H-(3.6+3.15) if C3011_H==. & Z1004=="MEX_2006"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="MEX_2006"
*tab  A2039_8_b if Z1004=="MEX_2006"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7+A2039_8)/8 if Z1004=="MEX_2006"
sum A2039 if Z1004=="MEX_2006"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b+A2039_8_b)/8 if Z1004=="MEX_2006"
sum  A2039_B if Z1004=="MEX_2006"
****************************************************************************************
***MEX_2009
sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="MEX_2009" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="MEX_2009" 

*tab C3011_A if Z1004=="MEX_2009", mis
*tab C3011_B if Z1004=="MEX_2009", mis
*tab C3011_C if Z1004=="MEX_2009", mis
*tab C3011_D if Z1004=="MEX_2009", mis
*tab C3011_E if Z1004=="MEX_2009", mis
*tab C3011_F if Z1004=="MEX_2009", mis
*tab C3011_G if Z1004=="MEX_2009", mis
*tab C3011_H if Z1004=="MEX_2009", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2009"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2009"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2009"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2009"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2009"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2009"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2009"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2009"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2009"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*8 parties 
** EHCGADFB
replace A2037_1 =0 if C3011_E< C3011_H & Z1004=="MEX_2009"
replace A2037_1 =0 if C3011_E> C3011_H & Z1004=="MEX_2009"
replace A2037_1 =1 if C3011_E == C3011_H & Z1004=="MEX_2009"
replace A2037_1 =0 if C3011_E ==. & Z1004=="MEX_2009"
replace A2037_1 =0 if C3011_H ==. & Z1004=="MEX_2009"
*list A2037_1 C3011_E C3011_F if Z1004=="MEX_2009"
*tab A2037_1 if Z1004=="MEX_2009", miss

replace A2037_2 =1 if C3011_E< C3011_C & Z1004=="MEX_2009"
replace A2037_2 =0 if C3011_E> C3011_C & Z1004=="MEX_2009"
replace A2037_2 =0 if C3011_E == C3011_C & Z1004=="MEX_2009"
replace A2037_2 =0 if C3011_E ==. & Z1004=="MEX_2009"
replace A2037_2 =0 if C3011_C ==. & Z1004=="MEX_2009"
*list A2037_2 C3011_F C3011_B if Z1004=="MEX_2009"
*tab A2037_2 if Z1004=="MEX_2009", miss

replace A2037_3 =1 if C3011_C< C3011_G & Z1004=="MEX_2009"
replace A2037_3 =0 if C3011_C> C3011_G & Z1004=="MEX_2009"
replace A2037_3 =0 if C3011_C == C3011_G & Z1004=="MEX_2009"
replace A2037_3 =0 if C3011_C ==. & Z1004=="MEX_2009"
replace A2037_3 =0 if C3011_G ==. & Z1004=="MEX_2009"
*list A2037_3 C3011_B C3011_F if Z1004=="MEX_2009"
*tab A2037_3 if Z1004=="MEX_2009", miss

replace A2037_4 =1 if C3011_G< C3011_A & Z1004=="MEX_2009"
replace A2037_4 =0 if C3011_G> C3011_A & Z1004=="MEX_2009"
replace A2037_4 =0 if C3011_G == C3011_A & Z1004=="MEX_2009"
replace A2037_4 =0 if C3011_G ==. & Z1004=="MEX_2009"
replace A2037_4 =0 if C3011_A ==. & Z1004=="MEX_2009"
*list A2037_4 C3011_C C3011_H if Z1004=="MEX_2009"
*tab A2037_4 if Z1004=="MEX_2009"

replace A2037_5 =1 if C3011_A< C3011_D & Z1004=="MEX_2009"
replace A2037_5 =0 if C3011_A> C3011_D & Z1004=="MEX_2009"
replace A2037_5 =0 if C3011_A == C3011_D & Z1004=="MEX_2009"
replace A2037_5 =0 if C3011_A ==. & Z1004=="MEX_2009"
replace A2037_5 =0 if C3011_D ==. & Z1004=="MEX_2009"
*list A2037_5 C3011_D C3011_H if Z1004=="MEX_2009"
*tab A2037_5 if Z1004=="MEX_2009", miss

replace A2037_6 =0 if C3011_D< C3011_F & Z1004=="MEX_2009"
replace A2037_6 =0 if C3011_D> C3011_F & Z1004=="MEX_2009"
replace A2037_6 =1 if C3011_D == C3011_F & Z1004=="MEX_2009"
replace A2037_6 =0 if C3011_D ==. & Z1004=="MEX_2009"
replace A2037_6 =0 if C3011_F ==. & Z1004=="MEX_2009"
*list A2037_6 C3011_D C3011_A if Z1004=="MEX_2009"
*tab A2037_6 if Z1004=="MEX_2009", miss

replace A2037_7 =1 if C3011_D< C3011_B & Z1004=="MEX_2009"
replace A2037_7 =0 if C3011_D> C3011_B & Z1004=="MEX_2009"
replace A2037_7 =0 if C3011_D == C3011_B & Z1004=="MEX_2009"
replace A2037_7 =0 if C3011_D ==. & Z1004=="MEX_2009"
replace A2037_7 =0 if C3011_B ==. & Z1004=="MEX_2009"
*list A2037_7 C3011_F C3011_G if Z1004=="MEX_2009"
*tab A2037_7 if Z1004=="MEX_2009", miss

replace A2037_8 =1 if C3011_E< C3011_B & Z1004=="MEX_2009"
replace A2037_8 =0 if C3011_E> C3011_B & Z1004=="MEX_2009"
replace A2037_8 =0 if C3011_E == C3011_B & Z1004=="MEX_2009"
replace A2037_8 =0 if C3011_E ==. & Z1004=="MEX_2009"
replace A2037_8 =0 if C3011_B ==. & Z1004=="MEX_2009"
*list A2037_8 C3011_E C3011_G if Z1004=="MEX_2009"
*tab A2037_8 if Z1004=="MEX_2009", miss

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7+A2037_8)/8 if Z1004=="MEX_2009"
*tab A2037 if Z1004=="MEX_2009"

*ii)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =1 if C3011_A<5 & Z1004=="MEX_2009"
replace A2038_1 =0 if C3011_A==5 & Z1004=="MEX_2009"
replace A2038_1 =0 if C3011_A>5  & Z1004=="MEX_2009"
replace A2038_1 =0 if C3011_A==.  & Z1004=="MEX_2009"
*tab A2038_1 if Z1004=="MEX_2009"

replace A2038_2 =1 if C3011_B>5 & Z1004=="MEX_2009"
replace A2038_2 =0 if C3011_B==5 & Z1004=="MEX_2009"
replace A2038_2 =0 if C3011_B<5  & Z1004=="MEX_2009"
replace A2038_2 =0 if C3011_B==.  & Z1004=="MEX_2009"
*list A2038_2 C3011_B if Z1004=="MEX_2009"
*tab A2038_2 if Z1004=="MEX_2009"

replace A2038_3 =0 if C3011_C>5 & Z1004=="MEX_2009"
replace A2038_3 =0 if C3011_C==5 & Z1004=="MEX_2009"
replace A2038_3 =1 if C3011_C<5  & Z1004=="MEX_2009"
replace A2038_3 =0 if C3011_C==.  & Z1004=="MEX_2009"
*tab A2038_3 if Z1004=="MEX_2009"
*list C3011_C A2038_3 if Z1004=="MEX_2009"

replace A2038_4 =0 if C3011_D<5 & Z1004=="MEX_2009"
replace A2038_4 =0 if C3011_D==5 & Z1004=="MEX_2009"
replace A2038_4 =1 if C3011_D>5  & Z1004=="MEX_2009"
replace A2038_4 =0 if C3011_D==.  & Z1004=="MEX_2009"
*list C3011_D A2038_4 if Z1004=="MEX_2009"
*tab A2038_4 if Z1004=="MEX_2009"

replace A2038_5 =1 if C3011_E<5 & Z1004=="MEX_2009"
replace A2038_5 =0 if C3011_E==5 & Z1004=="MEX_2009"
replace A2038_5 =0 if C3011_E>5  & Z1004=="MEX_2009"
replace A2038_5 =0 if C3011_E==.  & Z1004=="MEX_2009"
*list C3011_E A2038_4 if Z1004=="MEX_2009"
*tab A2038_5 if Z1004=="MEX_2009"

replace A2038_6 =1 if C3011_F>5 & Z1004=="MEX_2009"
replace A2038_6 =0 if C3011_F==5 & Z1004=="MEX_2009"
replace A2038_6 =0 if C3011_F<5  & Z1004=="MEX_2009"
replace A2038_6 =0 if C3011_F==.  & Z1004=="MEX_2009"
*list C3011_H A2038_5 if Z1004=="MEX_2009"
*tab A2038_6 if Z1004=="MEX_2009"

replace A2038_7 =1 if C3011_G<5 & Z1004=="MEX_2009"
replace A2038_7 =0 if C3011_G==5 & Z1004=="MEX_2009"
replace A2038_7 =0 if C3011_G>5  & Z1004=="MEX_2009"
replace A2038_7 =0 if C3011_G==.  & Z1004=="MEX_2009"
*list C3011_G A2038_7 if Z1004=="MEX_2009"
*tab A2038_7 if Z1004=="MEX_2009"

replace A2038_8 =1 if C3011_H<5 & Z1004=="MEX_2009"
replace A2038_8 =0 if C3011_H==5 & Z1004=="MEX_2009"
replace A2038_8 =0 if C3011_H>5  & Z1004=="MEX_2009"
replace A2038_8 =0 if C3011_H==.  & Z1004=="MEX_2009"
*list C3011_H A2038_8 if Z1004=="MEX_2009"
*tab A2038_8 if Z1004=="MEX_2009"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7+A2038_8)/8 if Z1004=="MEX_2009"
*tab A2038 if Z1004=="MEX_2009"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="MEX_2009"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="MEX_2009"
*tab  A2039_1 if Z1004=="MEX_2009"
***missings
sum C3011_A if Z1004=="MEX_2009"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="MEX_2009"
replace A2039_1_b= C5017_A-(6.98+2.84) if C3011_A==. & Z1004=="MEX_2009"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="MEX_2009"
*tab  A2039_1_b if Z1004=="MEX_2009"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="MEX_2009"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="MEX_2009"
*tab  A2039_2 if Z1004=="MEX_2009"
***missings
sum C3011_B if Z1004=="MEX_2009"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="MEX_2009"
replace A2039_2_b= C5017_B-(7.46+2.75) if C3011_B==. & Z1004=="MEX_2009"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="MEX_2009"
*tab  A2039_2_b if Z1004=="MEX_2009"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="MEX_2009"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="MEX_2009"
*tab  A2039_3 if Z1004=="MEX_2009"
***missings
sum C3011_C if Z1004=="MEX_2009"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="MEX_2009"
replace A2039_3_b= C5017_C-(3.9+3.12) if C3011_C==. & Z1004=="MEX_2009"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="MEX_2009"
*tab  A2039_3_b if Z1004=="MEX_2009"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="MEX_2009"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="MEX_2009"
*tab  A2039_4 if Z1004=="MEX_2009"
***missings
sum C3011_E if Z1004=="MEX_2009"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="MEX_2009"
replace A2039_4_b= C5017_E-(3.25+2.77) if C3011_E==. & Z1004=="MEX_2009"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="MEX_2009"
*tab  A2039_4_b if Z1004=="MEX_2009"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="MEX_2009"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="MEX_2009"
*tab  A2039_5 if Z1004=="MEX_2009"
***missings
sum C3011_D if Z1004=="MEX_2009"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="MEX_2009"
replace A2039_5_b= C5017_D-(5.39+2.89) if C3011_D==. & Z1004=="MEX_2009"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="MEX_2009"
*tab  A2039_5_b if Z1004=="MEX_2009"

*Party F
replace A2039_6 = C5017_F-C3011_F if Z1004=="MEX_2009"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="MEX_2009"
*tab  A2039_6 if Z1004=="MEX_2009"
***missings
sum C3011_F if Z1004=="MEX_2009"
replace A2039_6_b = C5017_F-C3011_F if Z1004=="MEX_2009"
replace A2039_6_b= C5017_F-(4.21+3.02) if C3011_F==. & Z1004=="MEX_2009"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="MEX_2009"
*tab  A2039_6_b if Z1004=="MEX_2009"

*Party G
replace A2039_7 = C5017_G-C3011_G if Z1004=="MEX_2009"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="MEX_2009"
*tab  A2039_7 if Z1004=="MEX_2009"
***missings
sum C3011_G if Z1004=="MEX_2009"
replace A2039_7_b = C5017_G-C3011_G if Z1004=="MEX_2009"
replace A2039_7_b= C5017_G-(3.42+2.8) if C3011_G==. & Z1004=="MEX_2009"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="MEX_2009"
*tab  A2039_7_b if Z1004=="MEX_2009"

*Party H
replace A2039_8 = C5017_H-C3011_H if Z1004=="MEX_2009"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="MEX_2009"
*tab  A2039_8 if Z1004=="MEX_2009"
***missings
sum C3011_H if Z1004=="MEX_2009"
replace A2039_8_b = C5017_H-C3011_H if Z1004=="MEX_2009"
replace A2039_8_b= C5017_H-(3.25+2.85) if C3011_H==. & Z1004=="MEX_2009"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="MEX_2009"
*tab  A2039_8_b if Z1004=="MEX_2009"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7+A2039_8)/8 if Z1004=="MEX_2009"
sum A2039 if Z1004=="MEX_2009"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b+A2039_8_b)/8 if Z1004=="MEX_2009"
sum  A2039_B if Z1004=="MEX_2009"

****************************************************************************************
***NLD_2010
sum C5017_A C5017_B C5017_C C5017_D C5017_E C5017_F C5017_G C5017_H if Z1004=="NLD_2010" 
sum C3011_A C3011_B C3011_C C3011_D C3011_E C3011_F C3011_G C3011_H if Z1004=="NLD_2010" 

*tab C3011_A if Z1004=="NLD_2010", mis
*tab C3011_B if Z1004=="NLD_2010", mis
*tab C3011_C if Z1004=="NLD_2010", mis
*tab C3011_D if Z1004=="NLD_2010", mis
*tab C3011_E if Z1004=="NLD_2010", mis
*tab C3011_F if Z1004=="NLD_2010", mis
*tab C3011_G if Z1004=="NLD_2010", mis
*tab C3011_H if Z1004=="NLD_2010", mis

**
mvdecode C3011_A, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2010"
mvdecode C3011_B, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2010"
mvdecode C3011_C, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2010"
mvdecode C3011_D, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2010"
mvdecode C3011_E, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2010"
mvdecode C3011_F, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2010"
mvdecode C3011_G, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2010"
mvdecode C3011_H, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2010"
mvdecode C3011_I, mv(95, 96, 97, 98, 99), if Z1004=="NLD_2010"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*8 parties 
** EGBFHCDA
replace A2037_1 =1 if C3011_E< C3011_B & Z1004=="NLD_2010"
replace A2037_1 =0 if C3011_E> C3011_B & Z1004=="NLD_2010"
replace A2037_1 =0 if C3011_E == C3011_B & Z1004=="NLD_2010"
replace A2037_1 =0 if C3011_E ==. & Z1004=="NLD_2010"
replace A2037_1 =0 if C3011_B ==. & Z1004=="NLD_2010"
*list A2037_1 C3011_E C3011_F if Z1004=="NLD_2010"
*tab A2037_1 if Z1004=="NLD_2010", miss

replace A2037_2 =0 if C3011_G< C3011_B & Z1004=="NLD_2010"
replace A2037_2 =0 if C3011_G> C3011_B & Z1004=="NLD_2010"
replace A2037_2 =1 if C3011_G == C3011_B & Z1004=="NLD_2010"
replace A2037_2 =0 if C3011_G ==. & Z1004=="NLD_2010"
replace A2037_2 =0 if C3011_B ==. & Z1004=="NLD_2010"
*list A2037_2 C3011_F C3011_B if Z1004=="NLD_2010"
*tab A2037_2 if Z1004=="NLD_2010", miss

replace A2037_3 =1 if C3011_B< C3011_F & Z1004=="NLD_2010"
replace A2037_3 =0 if C3011_B> C3011_F & Z1004=="NLD_2010"
replace A2037_3 =0 if C3011_B == C3011_F & Z1004=="NLD_2010"
replace A2037_3 =0 if C3011_B ==. & Z1004=="NLD_2010"
replace A2037_3 =0 if C3011_F ==. & Z1004=="NLD_2010"
*list A2037_3 C3011_B C3011_F if Z1004=="NLD_2010"
*tab A2037_3 if Z1004=="NLD_2010", miss

replace A2037_4 =0 if C3011_H< C3011_F & Z1004=="NLD_2010"
replace A2037_4 =0 if C3011_H> C3011_F & Z1004=="NLD_2010"
replace A2037_4 =1 if C3011_H == C3011_F & Z1004=="NLD_2010"
replace A2037_4 =0 if C3011_H ==. & Z1004=="NLD_2010"
replace A2037_4 =0 if C3011_F ==. & Z1004=="NLD_2010"
*list A2037_4 C3011_C C3011_H if Z1004=="NLD_2010"
*tab A2037_4 if Z1004=="NLD_2010"

replace A2037_5 =0 if C3011_C< C3011_F & Z1004=="NLD_2010"
replace A2037_5 =1 if C3011_C> C3011_F & Z1004=="NLD_2010"
replace A2037_5 =0 if C3011_C == C3011_F & Z1004=="NLD_2010"
replace A2037_5 =0 if C3011_C ==. & Z1004=="NLD_2010"
replace A2037_5 =0 if C3011_F ==. & Z1004=="NLD_2010"
*list A2037_5 C3011_D C3011_H if Z1004=="NLD_2010"
*tab A2037_5 if Z1004=="NLD_2010", miss

replace A2037_6 =0 if C3011_C< C3011_D & Z1004=="NLD_2010"
replace A2037_6 =0 if C3011_C> C3011_D & Z1004=="NLD_2010"
replace A2037_6 =1 if C3011_C == C3011_D & Z1004=="NLD_2010"
replace A2037_6 =0 if C3011_C ==. & Z1004=="NLD_2010"
replace A2037_6 =0 if C3011_D ==. & Z1004=="NLD_2010"
*list A2037_6 C3011_D C3011_A if Z1004=="NLD_2010"
*tab A2037_6 if Z1004=="NLD_2010", miss

replace A2037_7 =1 if C3011_D< C3011_A & Z1004=="NLD_2010"
replace A2037_7 =0 if C3011_D> C3011_A & Z1004=="NLD_2010"
replace A2037_7 =0 if C3011_D == C3011_A & Z1004=="NLD_2010"
replace A2037_7 =0 if C3011_D ==. & Z1004=="NLD_2010"
replace A2037_7 =0 if C3011_A ==. & Z1004=="NLD_2010"
*list A2037_7 C3011_F C3011_G if Z1004=="NLD_2010"
*tab A2037_7 if Z1004=="NLD_2010", miss

replace A2037_8 =0 if C3011_A< C3011_E & Z1004=="NLD_2010"
replace A2037_8 =1 if C3011_A> C3011_E & Z1004=="NLD_2010"
replace A2037_8 =0 if C3011_A == C3011_E & Z1004=="NLD_2010"
replace A2037_8 =0 if C3011_A ==. & Z1004=="NLD_2010"
replace A2037_8 =0 if C3011_E ==. & Z1004=="NLD_2010"
*list A2037_8 C3011_E C3011_G if Z1004=="NLD_2010"
*tab A2037_8 if Z1004=="NLD_2010", miss

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7+A2037_8)/8 if Z1004=="NLD_2010"
*tab A2037 if Z1004=="NLD_2010"

*ii)correct placement of parties on the left-right is following the 
*8 parties
replace A2038_1 =0 if C3011_A<5 & Z1004=="NLD_2010"
replace A2038_1 =0 if C3011_A==5 & Z1004=="NLD_2010"
replace A2038_1 =1 if C3011_A>5  & Z1004=="NLD_2010"
replace A2038_1 =0 if C3011_A==.  & Z1004=="NLD_2010"
*tab A2038_1 if Z1004=="NLD_2010"

replace A2038_2 =0 if C3011_B>5 & Z1004=="NLD_2010"
replace A2038_2 =0 if C3011_B==5 & Z1004=="NLD_2010"
replace A2038_2 =1 if C3011_B<5  & Z1004=="NLD_2010"
replace A2038_2 =0 if C3011_B==.  & Z1004=="NLD_2010"
*list A2038_2 C3011_B if Z1004=="NLD_2010"
*tab A2038_2 if Z1004=="NLD_2010"

replace A2038_3 =1 if C3011_C>5 & Z1004=="NLD_2010"
replace A2038_3 =0 if C3011_C==5 & Z1004=="NLD_2010"
replace A2038_3 =0 if C3011_C<5  & Z1004=="NLD_2010"
replace A2038_3 =0 if C3011_C==.  & Z1004=="NLD_2010"
*tab A2038_3 if Z1004=="NLD_2010"
*list C3011_C A2038_3 if Z1004=="NLD_2010"

replace A2038_4 =0 if C3011_D<5 & Z1004=="NLD_2010"
replace A2038_4 =0 if C3011_D==5 & Z1004=="NLD_2010"
replace A2038_4 =1 if C3011_D>5  & Z1004=="NLD_2010"
replace A2038_4 =0 if C3011_D==.  & Z1004=="NLD_2010"
*list C3011_D A2038_4 if Z1004=="NLD_2010"
*tab A2038_4 if Z1004=="NLD_2010"

replace A2038_5 =1 if C3011_E<5 & Z1004=="NLD_2010"
replace A2038_5 =0 if C3011_E==5 & Z1004=="NLD_2010"
replace A2038_5 =0 if C3011_E>5  & Z1004=="NLD_2010"
replace A2038_5 =0 if C3011_E==.  & Z1004=="NLD_2010"
*list C3011_E A2038_4 if Z1004=="NLD_2010"
*tab A2038_5 if Z1004=="NLD_2010"

replace A2038_6 =0 if C3011_F>5 & Z1004=="NLD_2010"
replace A2038_6 =1 if C3011_F==5 & Z1004=="NLD_2010"
replace A2038_6 =0 if C3011_F<5  & Z1004=="NLD_2010"
replace A2038_6 =0 if C3011_F==.  & Z1004=="NLD_2010"
*list C3011_H A2038_5 if Z1004=="NLD_2010"
*tab A2038_6 if Z1004=="NLD_2010"

replace A2038_7 =1 if C3011_G<5 & Z1004=="NLD_2010"
replace A2038_7 =0 if C3011_G==5 & Z1004=="NLD_2010"
replace A2038_7 =0 if C3011_G>5  & Z1004=="NLD_2010"
replace A2038_7 =0 if C3011_G==.  & Z1004=="NLD_2010"
*list C3011_G A2038_7 if Z1004=="NLD_2010"
*tab A2038_7 if Z1004=="NLD_2010"

replace A2038_8 =0 if C3011_H<5 & Z1004=="NLD_2010"
replace A2038_8 =1 if C3011_H==5 & Z1004=="NLD_2010"
replace A2038_8 =0 if C3011_H>5  & Z1004=="NLD_2010"
replace A2038_8 =0 if C3011_H==.  & Z1004=="NLD_2010"
*list C3011_H A2038_8 if Z1004=="NLD_2010"
*tab A2038_8 if Z1004=="NLD_2010"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7+A2038_8)/8 if Z1004=="NLD_2010"
*tab A2038 if Z1004=="NLD_2010"

**version iii
**Party A
replace A2039_1 = C5017_A-C3011_A if Z1004=="NLD_2010"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="NLD_2010"
*tab  A2039_1 if Z1004=="NLD_2010"
***missings
sum C3011_A if Z1004=="NLD_2010"
replace A2039_1_b = C5017_A-C3011_A if Z1004=="NLD_2010"
replace A2039_1_b= C5017_A-(7.34+2.06) if C3011_A==. & Z1004=="NLD_2010"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="NLD_2010"
*tab  A2039_1_b if Z1004=="NLD_2010"

**Party B
replace A2039_2 = C5017_B-C3011_B if Z1004=="NLD_2010"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="NLD_2010"
*tab  A2039_2 if Z1004=="NLD_2010"
***missings
sum C3011_B if Z1004=="NLD_2010"
replace A2039_2_b = C5017_B-C3011_B if Z1004=="NLD_2010"
replace A2039_2_b= C5017_B-(3.22+1.91) if C3011_B==. & Z1004=="NLD_2010"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="NLD_2010"
*tab  A2039_2_b if Z1004=="NLD_2010"

**Party C
replace A2039_3 = C5017_C-C3011_C if Z1004=="NLD_2010"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="NLD_2010"
*tab  A2039_3 if Z1004=="NLD_2010"
***missings
sum C3011_C if Z1004=="NLD_2010"
replace A2039_3_b = C5017_C-C3011_C if Z1004=="NLD_2010"
replace A2039_3_b= C5017_C-(7.77+2.67) if C3011_C==. & Z1004=="NLD_2010"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="NLD_2010"
*tab  A2039_3_b if Z1004=="NLD_2010"

**Party E
replace A2039_4 = C5017_E-C3011_E if Z1004=="NLD_2010"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="NLD_2010"
*tab  A2039_4 if Z1004=="NLD_2010"
***missings
sum C3011_E if Z1004=="NLD_2010"
replace A2039_4_b = C5017_E-C3011_E if Z1004=="NLD_2010"
replace A2039_4_b= C5017_E-(2.48+2.02) if C3011_E==. & Z1004=="NLD_2010"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="NLD_2010"
*tab  A2039_4_b if Z1004=="NLD_2010"

**Party D
replace A2039_5 = C5017_D-C3011_D if Z1004=="NLD_2010"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="NLD_2010"
*tab  A2039_5 if Z1004=="NLD_2010"
***missings
sum C3011_D if Z1004=="NLD_2010"
replace A2039_5_b = C5017_D-C3011_D if Z1004=="NLD_2010"
replace A2039_5_b= C5017_D-(5.9+1.9) if C3011_D==. & Z1004=="NLD_2010"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="NLD_2010"
*tab  A2039_5_b if Z1004=="NLD_2010"

*Party F
replace A2039_6 = C5017_F-C3011_F if Z1004=="NLD_2010"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="NLD_2010"
*tab  A2039_6 if Z1004=="NLD_2010"
***missings
sum C3011_F if Z1004=="NLD_2010"
replace A2039_6_b = C5017_F-C3011_F if Z1004=="NLD_2010"
replace A2039_6_b= C5017_F-(4.58+1.58) if C3011_F==. & Z1004=="NLD_2010"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="NLD_2010"
*tab  A2039_6_b if Z1004=="NLD_2010"

*Party G
replace A2039_7 = C5017_G-C3011_G if Z1004=="NLD_2010"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="NLD_2010"
*tab  A2039_7 if Z1004=="NLD_2010"
***missings
sum C3011_G if Z1004=="NLD_2010"
replace A2039_7_b = C5017_G-C3011_G if Z1004=="NLD_2010"
replace A2039_7_b= C5017_G-(2.37+1.65) if C3011_G==. & Z1004=="NLD_2010"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="NLD_2010"
*tab  A2039_7_b if Z1004=="NLD_2010"

*Party H
replace A2039_8 = C5017_H-C3011_H if Z1004=="NLD_2010"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="NLD_2010"
*tab  A2039_8 if Z1004=="NLD_2010"
***missings
sum C3011_H if Z1004=="NLD_2010"
replace A2039_8_b = C5017_H-C3011_H if Z1004=="NLD_2010"
replace A2039_8_b= C5017_H-(5.39+2.12) if C3011_H==. & Z1004=="NLD_2010"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="NLD_2010"
*tab  A2039_8_b if Z1004=="NLD_2010"

**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7+A2039_8)/8 if Z1004=="NLD_2010"
sum A2039 if Z1004=="NLD_2010"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b+A2039_8_b)/8 if Z1004=="NLD_2010"
sum  A2039_B if Z1004=="NLD_2010"
****************************************************************************************
*FRA 2012
sum D5017_A D5017_B D5017_C D5017_D D5017_E D5017_F D5017_G D5017_H if Z1004=="FRA_2012" 
sum D3013_A D3013_B D3013_C D3013_D D3013_E D3013_F D3013_G D3013_H if Z1004=="FRA_2012" 


*tab D3013_A if Z1004=="FRA_2012", mis
*tab D3013_B if Z1004=="FRA_2012", mis
*tab D3013_C if Z1004=="FRA_2012", mis
*tab D3013_D if Z1004=="FRA_2012", mis
*tab D3013_E if Z1004=="FRA_2012", mis
*tab D3013_F if Z1004=="FRA_2012", mis
*tab D3013_G if Z1004=="FRA_2012", mis
*tab D3013_H if Z1004=="FRA_2012", mis

mvdecode D3013_A, mv(96, 97, 98, 99), if Z1004=="FRA_2012"
mvdecode D3013_B, mv(96, 97, 98, 99), if Z1004=="FRA_2012"
mvdecode D3013_C, mv(96, 97, 98, 99), if Z1004=="FRA_2012"
mvdecode D3013_D, mv(96, 97, 98, 99), if Z1004=="FRA_2012"
mvdecode D3013_F, mv(96, 97, 98, 99), if Z1004=="FRA_2012"
mvdecode D3013_G, mv(96, 97, 98, 99), if Z1004=="FRA_2012"
mvdecode D3013_E, mv(96, 97, 98, 99), if Z1004=="FRA_2012"
mvdecode D3013_H, mv(96, 97, 98, 99), if Z1004=="FRA_2012"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*6 parties 
**DFAEBC
replace A2037_1 =1 if D3013_D< D3013_F & Z1004=="FRA_2012"
replace A2037_1 =0 if D3013_D> D3013_F & Z1004=="FRA_2012"
replace A2037_1 =0 if D3013_D == D3013_F & Z1004=="FRA_2012"
replace A2037_1 =0 if D3013_D ==. & Z1004=="FRA_2012"
replace A2037_1 =0 if D3013_A ==. & Z1004=="FRA_2012"
*list A2037_1 D3013_H D3013_G if Z1004=="FRA_2012"
*tab A2037_1 if Z1004=="FRA_2012", miss

replace A2037_2 =1 if D3013_F< D3013_A & Z1004=="FRA_2012"
replace A2037_2 =0 if D3013_F> D3013_A & Z1004=="FRA_2012"
replace A2037_2 =0 if D3013_F == D3013_A & Z1004=="FRA_2012"
replace A2037_2 =0 if D3013_F ==. & Z1004=="FRA_2012"
replace A2037_2 =0 if D3013_A ==. & Z1004=="FRA_2012"
*list A2037_2 D3013_A D3013_B if Z1004=="FRA_2012"
*tab A2037_2 if Z1004=="FRA_2012"

replace A2037_3 =1 if D3013_A< D3013_E & Z1004=="FRA_2012"
replace A2037_3 =0 if D3013_A> D3013_E & Z1004=="FRA_2012"
replace A2037_3 =0 if D3013_A == D3013_E & Z1004=="FRA_2012"
replace A2037_3 =0 if D3013_A ==. & Z1004=="FRA_2012"
replace A2037_3 =0 if D3013_E ==. & Z1004=="FRA_2012"
*list A2037_3 D3013_F D3013_B if Z1004=="FRA_2012"
*tab A2037_3 if Z1004=="FRA_2012"

replace A2037_4 =1 if D3013_E< D3013_B & Z1004=="FRA_2012"
replace A2037_4 =0 if D3013_E> D3013_B & Z1004=="FRA_2012"
replace A2037_4 =0 if D3013_E == D3013_B & Z1004=="FRA_2012"
replace A2037_4 =0 if D3013_E ==. & Z1004=="FRA_2012"
replace A2037_4 =0 if D3013_B ==. & Z1004=="FRA_2012"
*list A2037_4 D3013_F D3013_E if Z1004=="FRA_2012"
*tab A2037_4 if Z1004=="FRA_2012"

replace A2037_5 =1 if D3013_B< D3013_C & Z1004=="FRA_2012"
replace A2037_5 =0 if D3013_B> D3013_C & Z1004=="FRA_2012"
replace A2037_5 =0 if D3013_B == D3013_C & Z1004=="FRA_2012"
replace A2037_5 =0 if D3013_B ==. & Z1004=="FRA_2012"
replace A2037_5 =0 if D3013_B ==. & Z1004=="FRA_2012"
*list A2037_5 D3013_C D3013_G if Z1004=="FRA_2012"
*tab A2037_5 if Z1004=="FRA_2012", missing

replace A2037_6 =1 if D3013_D< D3013_C & Z1004=="FRA_2012"
replace A2037_6 =0 if D3013_D> D3013_C & Z1004=="FRA_2012"
replace A2037_6 =0 if D3013_D == D3013_C & Z1004=="FRA_2012"
replace A2037_6 =0 if D3013_D ==. & Z1004=="FRA_2012"
replace A2037_6 =0 if D3013_C ==. & Z1004=="FRA_2012"
*list A2037_6 D3013_C D3013_G if Z1004=="FRA_2012"
*tab A2037_6 if Z1004=="FRA_2012", missing

*replace A2037_7 =1 if D3013_D< D3013_C & Z1004=="FRA_2012"
*replace A2037_7 =0 if D3013_D> D3013_C & Z1004=="FRA_2012"
*replace A2037_7 =0 if D3013_D == D3013_C & Z1004=="FRA_2012"
*replace A2037_7 =0 if D3013_D ==. & Z1004=="FRA_2012"
*replace A2037_7 =0 if D3013_C ==. & Z1004=="FRA_2012"
*list A2037_7 D3013_C D3013_G if Z1004=="FRA_2012"
**tab A2037_7 if Z1004=="FRA_2012", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6)/6 if Z1004=="FRA_2012"
*tab A2037 if Z1004=="FRA_2012"

*ii)correct placement of parties on the left-right is following the 
*7 parties
replace A2038_1 =1 if D3013_A<5 & Z1004=="FRA_2012"
replace A2038_1 =0 if D3013_A==5 & Z1004=="FRA_2012"
replace A2038_1 =0 if D3013_A>5  & Z1004=="FRA_2012"
replace A2038_1 =0 if D3013_A==.  & Z1004=="FRA_2012"
*tab A2038_1 if Z1004=="FRA_2012"

replace A2038_2 =1 if D3013_B>5 & Z1004=="FRA_2012"
replace A2038_2 =0 if D3013_B==5 & Z1004=="FRA_2012"
replace A2038_2 =0 if D3013_B<5  & Z1004=="FRA_2012"
replace A2038_2 =0 if D3013_B==.  & Z1004=="FRA_2012"
*list A2038_2 D3013_B if Z1004=="FRA_2012"
*tab A2038_2 if Z1004=="FRA_2012"

replace A2038_3 =1 if D3013_C>5 & Z1004=="FRA_2012"
replace A2038_3 =0 if D3013_C==5 & Z1004=="FRA_2012"
replace A2038_3 =0 if D3013_C<5  & Z1004=="FRA_2012"
replace A2038_3 =0 if D3013_C==.  & Z1004=="FRA_2012"
*tab A2038_3 if Z1004=="FRA_2012"
*list D3013_C A2038_3 if Z1004=="FRA_2012"

replace A2038_4 =1 if D3013_D<5 & Z1004=="FRA_2012"
replace A2038_4 =0 if D3013_D==5 & Z1004=="FRA_2012"
replace A2038_4 =0 if D3013_D>5  & Z1004=="FRA_2012"
replace A2038_4 =0 if D3013_D==.  & Z1004=="FRA_2012"
*list D3013_D A2038_4 if Z1004=="FRA_2012"
*tab A2038_4 if Z1004=="FRA_2012"

replace A2038_5 =0 if D3013_F>5 & Z1004=="FRA_2012"
replace A2038_5 =0 if D3013_F==5 & Z1004=="FRA_2012"
replace A2038_5 =1 if D3013_F<5  & Z1004=="FRA_2012"
replace A2038_5 =0 if D3013_F==.  & Z1004=="FRA_2012"
*list D3013_F A2038_5 if Z1004=="FRA_2012"
*tab A2038_5 if Z1004=="FRA_2012"

replace A2038_6 =0 if D3013_E>5 & Z1004=="FRA_2012"
replace A2038_6 =1 if D3013_E==5 & Z1004=="FRA_2012"
replace A2038_6 =0 if D3013_E<5  & Z1004=="FRA_2012"
replace A2038_6 =0 if D3013_E==.  & Z1004=="FRA_2012"
*list D3013_E A2038_5 if Z1004=="FRA_2012"
*tab A2038_6 if Z1004=="FRA_2012"

*replace A2038_7 =1 if D3013_G>5 & Z1004=="FRA_2012"
*replace A2038_7 =0 if D3013_G==5 & Z1004=="FRA_2012"
*replace A2038_7 =0 if D3013_G<5  & Z1004=="FRA_2012"
*replace A2038_7 =0 if D3013_G==.  & Z1004=="FRA_2012"
*list D3013_G A2038_5 if Z1004=="FRA_2012"
**tab A2038_7 if Z1004=="FRA_2012"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6)/6 if Z1004=="FRA_2012"
*tab A2038 if Z1004=="FRA_2012"

**version iii
**Party A
replace A2039_1 = D5017_A-D3013_A if Z1004=="FRA_2012"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="FRA_2012"
*tab  A2039_1 if Z1004=="FRA_2012"
***missings
sum D3013_A if Z1004=="FRA_2012"
replace A2039_1_b = D5017_A-D3013_A if Z1004=="FRA_2012"
replace A2039_1_b= D5017_A-(3.29+1.83) if D3013_A==. & Z1004=="FRA_2012"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="FRA_2012"
*tab  A2039_1_b if Z1004=="FRA_2012"

**Party B
replace A2039_2 = D5017_B-D3013_B if Z1004=="FRA_2012"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="FRA_2012"
*tab  A2039_2 if Z1004=="FRA_2012"
***missings
sum D3013_B if Z1004=="FRA_2012"
replace A2039_2_b = D5017_B-D3013_B if Z1004=="FRA_2012"
replace A2039_2_b= D5017_B-(7.77+1.75) if D3013_B==. & Z1004=="FRA_2012"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="FRA_2012"
*tab  A2039_2_b if Z1004=="FRA_2012"

**Party C
replace A2039_3 = D5017_C-D3013_C if Z1004=="FRA_2012"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="FRA_2012"
*tab  A2039_3 if Z1004=="FRA_2012"
***missings
sum D3013_C if Z1004=="FRA_2012"
replace A2039_3_b = D5017_C-D3013_C if Z1004=="FRA_2012"
replace A2039_3_b= D5017_C-(8.7+2.29) if D3013_C==. & Z1004=="FRA_2012"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="FRA_2012"
*tab  A2039_3_b if Z1004=="FRA_2012"

**Party D
replace A2039_4 = D5017_D-D3013_D if Z1004=="FRA_2012"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="FRA_2012"
*tab  A2039_4 if Z1004=="FRA_2012"
***missings
sum D3013_D if Z1004=="FRA_2012"
replace A2039_4_b = D5017_D-D3013_D if Z1004=="FRA_2012"
replace A2039_4_b= D5017_D-(1.45+1.75) if D3013_D==. & Z1004=="FRA_2012"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="FRA_2012"
*tab  A2039_4_b if Z1004=="FRA_2012"

**Party F
replace A2039_5 = D5017_F-D3013_F if Z1004=="FRA_2012"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="FRA_2012"
*tab  A2039_5 if Z1004=="FRA_2012"
***missings
sum D3013_F if Z1004=="FRA_2012"
replace A2039_5_b = D5017_F-D3013_F if Z1004=="FRA_2012"
replace A2039_5_b= D5017_F-(3.35+1.63) if D3013_F==. & Z1004=="FRA_2012"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="FRA_2012"
*tab  A2039_5_b if Z1004=="FRA_2012"

**Party E
replace A2039_6 = D5017_E-D3013_E if Z1004=="FRA_2012"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="FRA_2012"
*tab  A2039_6 if Z1004=="FRA_2012"
***missings
sum D3013_E if Z1004=="FRA_2012"
replace A2039_6_b = D5017_E-D3013_E if Z1004=="FRA_2012"
replace A2039_6_b= D5017_E-(5.18+1.41) if D3013_E==. & Z1004=="FRA_2012"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="FRA_2012"
*tab  A2039_6_b if Z1004=="FRA_2012"

**Party G
*replace A2039_7 = D5017_G-D3013_G if Z1004=="FRA_2012"
*replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="FRA_2012"
**tab  A2039_7 if Z1004=="FRA_2012"
***missings
*sum D3013_G if Z1004=="FRA_2012"
*replace A2039_7_b = D5017_G-D3013_G if Z1004=="FRA_2012"
*replace A2039_7_b= D5017_G-(6.15+2.59) if D3013_G==. & Z1004=="FRA_2012"
*replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="FRA_2012"
**tab  A2039_7_b if Z1004=="FRA_2012"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6)/6 if Z1004=="FRA_2012"
sum A2039 if Z1004=="FRA_2012"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b)/6 if Z1004=="FRA_2012"
sum  A2039_B if Z1004=="FRA_2012"


****************************************************************************************
*MEX 2012
sum D5017_A D5017_B D5017_C D5017_D D5017_E D5017_F D5017_G D5017_H if Z1004=="MEX_2012" 
sum D3013_A D3013_B D3013_C D3013_D D3013_E D3013_F D3013_G D3013_H if Z1004=="MEX_2012" 

*tab D3013_A if Z1004=="MEX_2012", mis
*tab D3013_B if Z1004=="MEX_2012", mis
*tab D3013_C if Z1004=="MEX_2012", mis
*tab D3013_D if Z1004=="MEX_2012", mis
*tab D3013_E if Z1004=="MEX_2012", mis
*tab D3013_F if Z1004=="MEX_2012", mis
*tab D3013_G if Z1004=="MEX_2012", mis
*tab D3013_H if Z1004=="MEX_2012", mis

mvdecode D3013_A, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2012"
mvdecode D3013_B, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2012"
mvdecode D3013_C, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2012"
mvdecode D3013_D, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2012"
mvdecode D3013_F, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2012"
mvdecode D3013_G, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2012"
mvdecode D3013_E, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2012"
mvdecode D3013_H, mv(95, 96, 97, 98, 99), if Z1004=="MEX_2012"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*7 parties 
**EGCADFB
replace A2037_1 =0 if D3013_E< D3013_G & Z1004=="MEX_2012"
replace A2037_1 =0 if D3013_E> D3013_G & Z1004=="MEX_2012"
replace A2037_1 =1 if D3013_E == D3013_G & Z1004=="MEX_2012"
replace A2037_1 =0 if D3013_E ==. & Z1004=="MEX_2012"
replace A2037_1 =0 if D3013_G ==. & Z1004=="MEX_2012"
*list A2037_1 D3013_H D3013_G if Z1004=="MEX_2012"
*tab A2037_1 if Z1004=="MEX_2012", miss

replace A2037_2 =1 if D3013_E< D3013_C & Z1004=="MEX_2012"
replace A2037_2 =0 if D3013_E> D3013_C & Z1004=="MEX_2012"
replace A2037_2 =0 if D3013_E == D3013_C & Z1004=="MEX_2012"
replace A2037_2 =0 if D3013_E ==. & Z1004=="MEX_2012"
replace A2037_2 =0 if D3013_C ==. & Z1004=="MEX_2012"
*list A2037_2 D3013_A D3013_B if Z1004=="MEX_2012"
*tab A2037_2 if Z1004=="MEX_2012"

replace A2037_3 =1 if D3013_C< D3013_A & Z1004=="MEX_2012"
replace A2037_3 =0 if D3013_C> D3013_A & Z1004=="MEX_2012"
replace A2037_3 =0 if D3013_C == D3013_A & Z1004=="MEX_2012"
replace A2037_3 =0 if D3013_C ==. & Z1004=="MEX_2012"
replace A2037_3 =0 if D3013_A ==. & Z1004=="MEX_2012"
*list A2037_3 D3013_F D3013_B if Z1004=="MEX_2012"
*tab A2037_3 if Z1004=="MEX_2012"

replace A2037_4 =1 if D3013_A< D3013_D & Z1004=="MEX_2012"
replace A2037_4 =0 if D3013_A> D3013_D & Z1004=="MEX_2012"
replace A2037_4 =0 if D3013_A == D3013_D & Z1004=="MEX_2012"
replace A2037_4 =0 if D3013_A ==. & Z1004=="MEX_2012"
replace A2037_4 =0 if D3013_D ==. & Z1004=="MEX_2012"
*list A2037_4 D3013_F D3013_E if Z1004=="MEX_2012"
*tab A2037_4 if Z1004=="MEX_2012"

replace A2037_5 =0 if D3013_D< D3013_F & Z1004=="MEX_2012"
replace A2037_5 =0 if D3013_D> D3013_F & Z1004=="MEX_2012"
replace A2037_5 =1 if D3013_D == D3013_F & Z1004=="MEX_2012"
replace A2037_5 =0 if D3013_D ==. & Z1004=="MEX_2012"
replace A2037_5 =0 if D3013_F ==. & Z1004=="MEX_2012"
*list A2037_5 D3013_C D3013_G if Z1004=="MEX_2012"
*tab A2037_5 if Z1004=="MEX_2012", missing

replace A2037_6 =1 if D3013_F< D3013_B & Z1004=="MEX_2012"
replace A2037_6 =0 if D3013_F> D3013_B & Z1004=="MEX_2012"
replace A2037_6 =0 if D3013_F == D3013_B & Z1004=="MEX_2012"
replace A2037_6 =0 if D3013_F ==. & Z1004=="MEX_2012"
replace A2037_6 =0 if D3013_B ==. & Z1004=="MEX_2012"
*list A2037_6 D3013_F D3013_B if Z1004=="MEX_2012"
*tab A2037_6 if Z1004=="MEX_2012", missing

replace A2037_7 =1 if D3013_E< D3013_B & Z1004=="MEX_2012"
replace A2037_7 =0 if D3013_E> D3013_B & Z1004=="MEX_2012"
replace A2037_7 =0 if D3013_E == D3013_B & Z1004=="MEX_2012"
replace A2037_7 =0 if D3013_E ==. & Z1004=="MEX_2012"
replace A2037_7 =0 if D3013_B ==. & Z1004=="MEX_2012"
*list A2037_7 D3013_C D3013_G if Z1004=="MEX_2012"
*tab A2037_7 if Z1004=="MEX_2012", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7)/7 if Z1004=="MEX_2012"
*tab A2037 if Z1004=="MEX_2012"

*ii)correct placement of parties on the left-right is following the 
*7 parties
replace A2038_1 =0 if D3013_A<5 & Z1004=="MEX_2012"
replace A2038_1 =1 if D3013_A==5 & Z1004=="MEX_2012"
replace A2038_1 =0 if D3013_A>5  & Z1004=="MEX_2012"
replace A2038_1 =0 if D3013_A==.  & Z1004=="MEX_2012"
*tab A2038_1 if Z1004=="MEX_2012"

replace A2038_2 =1 if D3013_B>5 & Z1004=="MEX_2012"
replace A2038_2 =0 if D3013_B==5 & Z1004=="MEX_2012"
replace A2038_2 =0 if D3013_B<5  & Z1004=="MEX_2012"
replace A2038_2 =0 if D3013_B==.  & Z1004=="MEX_2012"
*list A2038_2 D3013_B if Z1004=="MEX_2012"
*tab A2038_2 if Z1004=="MEX_2012"

replace A2038_3 =0 if D3013_C>5 & Z1004=="MEX_2012"
replace A2038_3 =0 if D3013_C==5 & Z1004=="MEX_2012"
replace A2038_3 =1 if D3013_C<5  & Z1004=="MEX_2012"
replace A2038_3 =0 if D3013_C==.  & Z1004=="MEX_2012"
*tab A2038_3 if Z1004=="MEX_2012"
*list D3013_C A2038_3 if Z1004=="MEX_2012"

replace A2038_4 =0 if D3013_D<5 & Z1004=="MEX_2012"
replace A2038_4 =0 if D3013_D==5 & Z1004=="MEX_2012"
replace A2038_4 =1 if D3013_D>5  & Z1004=="MEX_2012"
replace A2038_4 =0 if D3013_D==.  & Z1004=="MEX_2012"
*list D3013_D A2038_4 if Z1004=="MEX_2012"
*tab A2038_4 if Z1004=="MEX_2012"

replace A2038_5 =1 if D3013_F>5 & Z1004=="MEX_2012"
replace A2038_5 =0 if D3013_F==5 & Z1004=="MEX_2012"
replace A2038_5 =0 if D3013_F<5  & Z1004=="MEX_2012"
replace A2038_5 =0 if D3013_F==.  & Z1004=="MEX_2012"
*list D3013_F A2038_5 if Z1004=="MEX_2012"
*tab A2038_5 if Z1004=="MEX_2012"

replace A2038_6 =0 if D3013_E>5 & Z1004=="MEX_2012"
replace A2038_6 =0 if D3013_E==5 & Z1004=="MEX_2012"
replace A2038_6 =1 if D3013_E<5  & Z1004=="MEX_2012"
replace A2038_6 =0 if D3013_E==.  & Z1004=="MEX_2012"
*list D3013_E A2038_5 if Z1004=="MEX_2012"
*tab A2038_6 if Z1004=="MEX_2012"

replace A2038_7 =0 if D3013_G>5 & Z1004=="MEX_2012"
replace A2038_7 =0 if D3013_G==5 & Z1004=="MEX_2012"
replace A2038_7 =1 if D3013_G<5  & Z1004=="MEX_2012"
replace A2038_7 =0 if D3013_G==.  & Z1004=="MEX_2012"
*list D3013_G A2038_5 if Z1004=="MEX_2012"
*tab A2038_7 if Z1004=="MEX_2012"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7)/7 if Z1004=="MEX_2012"
*tab A2038 if Z1004=="MEX_2012"

**version iii
**Party A
replace A2039_1 = D5017_A-D3013_A if Z1004=="MEX_2012"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="MEX_2012"
*tab  A2039_1 if Z1004=="MEX_2012"
***missings
sum D3013_A if Z1004=="MEX_2012"
replace A2039_1_b = D5017_A-D3013_A if Z1004=="MEX_2012"
replace A2039_1_b= D5017_A-(7.05+2.91) if D3013_A==. & Z1004=="MEX_2012"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="MEX_2012"
*tab  A2039_1_b if Z1004=="MEX_2012"

**Party B
replace A2039_2 = D5017_B-D3013_B if Z1004=="MEX_2012"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="MEX_2012"
*tab  A2039_2 if Z1004=="MEX_2012"
***missings
sum D3013_B if Z1004=="MEX_2012"
replace A2039_2_b = D5017_B-D3013_B if Z1004=="MEX_2012"
replace A2039_2_b= D5017_B-(6.54+3.17) if D3013_B==. & Z1004=="MEX_2012"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="MEX_2012"
*tab  A2039_2_b if Z1004=="MEX_2012"

**Party C
replace A2039_3 = D5017_C-D3013_C if Z1004=="MEX_2012"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="MEX_2012"
*tab  A2039_3 if Z1004=="MEX_2012"
***missings
sum D3013_C if Z1004=="MEX_2012"
replace A2039_3_b = D5017_C-D3013_C if Z1004=="MEX_2012"
replace A2039_3_b= D5017_C-(3.36+2.94) if D3013_C==. & Z1004=="MEX_2012"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="MEX_2012"
*tab  A2039_3_b if Z1004=="MEX_2012"

**Party D
replace A2039_4 = D5017_D-D3013_D if Z1004=="MEX_2012"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="MEX_2012"
*tab  A2039_4 if Z1004=="MEX_2012"
***missings
sum D3013_D if Z1004=="MEX_2012"
replace A2039_4_b = D5017_D-D3013_D if Z1004=="MEX_2012"
replace A2039_4_b= D5017_D-(5.51+3) if D3013_D==. & Z1004=="MEX_2012"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="MEX_2012"
*tab  A2039_4_b if Z1004=="MEX_2012"

**Party F
replace A2039_5 = D5017_F-D3013_F if Z1004=="MEX_2012"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="MEX_2012"
*tab  A2039_5 if Z1004=="MEX_2012"
***missings
sum D3013_F if Z1004=="MEX_2012"
replace A2039_5_b = D5017_F-D3013_F if Z1004=="MEX_2012"
replace A2039_5_b= D5017_F-(4.17+2.98) if D3013_F==. & Z1004=="MEX_2012"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="MEX_2012"
*tab  A2039_5_b if Z1004=="MEX_2012"

**Party E
replace A2039_6 = D5017_E-D3013_E if Z1004=="MEX_2012"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="MEX_2012"
*tab  A2039_6 if Z1004=="MEX_2012"
***missings
sum D3013_E if Z1004=="MEX_2012"
replace A2039_6_b = D5017_E-D3013_E if Z1004=="MEX_2012"
replace A2039_6_b= D5017_E-(3.09+2.71) if D3013_E==. & Z1004=="MEX_2012"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="MEX_2012"
*tab  A2039_6_b if Z1004=="MEX_2012"

**Party G
replace A2039_7 = D5017_G-D3013_G if Z1004=="MEX_2012"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="MEX_2012"
*tab  A2039_7 if Z1004=="MEX_2012"
***missings
sum D3013_G if Z1004=="MEX_2012"
replace A2039_7_b = D5017_G-D3013_G if Z1004=="MEX_2012"
replace A2039_7_b= D5017_G-(3.05+2.75) if D3013_G==. & Z1004=="MEX_2012"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="MEX_2012"
*tab  A2039_7_b if Z1004=="MEX_2012"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7)/7 if Z1004=="MEX_2012"
sum A2039 if Z1004=="MEX_2012"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b)/7 if Z1004=="MEX_2012"
sum  A2039_B if Z1004=="MEX_2012"
****************************************************************************************
*NZL_2011
sum D5017_A D5017_B D5017_C D5017_D D5017_E D5017_F D5017_G D5017_H D5017_I if Z1004=="NZL_2011" 
sum D3013_A D3013_B D3013_C D3013_D D3013_E D3013_F D3013_G D3013_H D3013_I if Z1004=="NZL_2011" 

***error in the macro data!!
replace D5017_G=1 if Z1004=="NZL_2011" 
replace D5017_F=6 if Z1004=="NZL_2011" 
replace D5017_I=6 if Z1004=="NZL_2011" 
replace D5017_H=9 if Z1004=="NZL_2011" 

*tab D3013_A if Z1004=="NZL_2011", mis
*tab D3013_B if Z1004=="NZL_2011", mis
*tab D3013_C if Z1004=="NZL_2011", mis
*tab D3013_D if Z1004=="NZL_2011", mis
*tab D3013_E if Z1004=="NZL_2011", mis
*tab D3013_F if Z1004=="NZL_2011", mis
*tab D3013_G if Z1004=="NZL_2011", mis
*tab D3013_H if Z1004=="NZL_2011", mis

mvdecode D3013_A, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2011"
mvdecode D3013_B, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2011"
mvdecode D3013_C, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2011"
mvdecode D3013_D, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2011"
mvdecode D3013_F, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2011"
mvdecode D3013_G, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2011"
mvdecode D3013_E, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2011"
mvdecode D3013_H, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2011"
mvdecode D3013_I, mv(95, 96, 97, 98, 99), if Z1004=="NZL_2011"

**i) respondents� ordering of sequences of political parties:A<B<C<D. 

*7 parties 
**GCBDFIAH
replace A2037_1 =1 if D3013_G< D3013_C & Z1004=="NZL_2011"
replace A2037_1 =0 if D3013_G> D3013_C & Z1004=="NZL_2011"
replace A2037_1 =0 if D3013_G == D3013_C & Z1004=="NZL_2011"
replace A2037_1 =0 if D3013_G ==. & Z1004=="NZL_2011"
replace A2037_1 =0 if D3013_C ==. & Z1004=="NZL_2011"
*list A2037_1 D3013_F D3013_C if Z1004=="NZL_2011"
tab A2037_1 if Z1004=="NZL_2011", miss

replace A2037_2 =1 if D3013_C< D3013_B & Z1004=="NZL_2011"
replace A2037_2 =0 if D3013_C> D3013_B & Z1004=="NZL_2011"
replace A2037_2 =0 if D3013_C == D3013_B & Z1004=="NZL_2011"
replace A2037_2 =0 if D3013_C ==. & Z1004=="NZL_2011"
replace A2037_2 =0 if D3013_B ==. & Z1004=="NZL_2011"
*list A2037_2 D3013_A D3013_B if Z1004=="NZL_2011"
tab A2037_2 if Z1004=="NZL_2011"

replace A2037_3 =1 if D3013_B< D3013_D & Z1004=="NZL_2011"
replace A2037_3 =0 if D3013_B> D3013_D & Z1004=="NZL_2011"
replace A2037_3 =0 if D3013_B == D3013_D & Z1004=="NZL_2011"
replace A2037_3 =0 if D3013_B ==. & Z1004=="NZL_2011"
replace A2037_3 =0 if D3013_D ==. & Z1004=="NZL_2011"
*list A2037_3 D3013_D D3013_B if Z1004=="NZL_2011"
tab A2037_3 if Z1004=="NZL_2011"

replace A2037_4 =0 if D3013_F< D3013_D & Z1004=="NZL_2011"
replace A2037_4 =0 if D3013_F> D3013_D & Z1004=="NZL_2011"
replace A2037_4 =1 if D3013_F == D3013_D & Z1004=="NZL_2011"
replace A2037_4 =0 if D3013_F ==. & Z1004=="NZL_2011"
replace A2037_4 =0 if D3013_D ==. & Z1004=="NZL_2011"
*list A2037_4 D3013_F D3013_D if Z1004=="NZL_2011"
tab A2037_4 if Z1004=="NZL_2011"

replace A2037_5 =1 if D3013_F< D3013_I & Z1004=="NZL_2011"
replace A2037_5 =0 if D3013_F> D3013_I & Z1004=="NZL_2011"
replace A2037_5 =0 if D3013_F == D3013_I & Z1004=="NZL_2011"
replace A2037_5 =0 if D3013_F ==. & Z1004=="NZL_2011"
replace A2037_5 =0 if D3013_I ==. & Z1004=="NZL_2011"
*list A2037_5 D3013_C D3013_G if Z1004=="NZL_2011"
tab A2037_5 if Z1004=="NZL_2011", missing

replace A2037_6 =1 if D3013_I< D3013_A & Z1004=="NZL_2011"
replace A2037_6 =0 if D3013_I> D3013_A & Z1004=="NZL_2011"
replace A2037_6 =0 if D3013_I == D3013_A & Z1004=="NZL_2011"
replace A2037_6 =0 if D3013_I ==. & Z1004=="NZL_2011"
replace A2037_6 =0 if D3013_A ==. & Z1004=="NZL_2011"
*list A2037_6 D3013_F D3013_B if Z1004=="NZL_2011"
tab A2037_6 if Z1004=="NZL_2011", missing

replace A2037_7 =1 if D3013_A< D3013_H & Z1004=="NZL_2011"
replace A2037_7 =0 if D3013_A> D3013_H & Z1004=="NZL_2011"
replace A2037_7 =0 if D3013_A == D3013_H & Z1004=="NZL_2011"
replace A2037_7 =0 if D3013_A ==. & Z1004=="NZL_2011"
replace A2037_7 =0 if D3013_H ==. & Z1004=="NZL_2011"
*list A2037_7 D3013_C D3013_G if Z1004=="NZL_2011"
tab A2037_7 if Z1004=="NZL_2011", missing

replace A2037_8 =1 if D3013_G< D3013_H & Z1004=="NZL_2011"
replace A2037_8 =0 if D3013_G> D3013_H & Z1004=="NZL_2011"
replace A2037_8 =0 if D3013_G == D3013_H & Z1004=="NZL_2011"
replace A2037_8 =0 if D3013_G ==. & Z1004=="NZL_2011"
replace A2037_8 =0 if D3013_H ==. & Z1004=="NZL_2011"
*list A2037_8 D3013_C D3013_G if Z1004=="NZL_2011"
tab A2037_8 if Z1004=="NZL_2011", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7+A2037_8)/8 if Z1004=="NZL_2011"
tab A2037 if Z1004=="NZL_2011"

*ii)correct placement of parties on the left-right is following the 
*7 parties
replace A2038_1 =0 if D3013_A<5 & Z1004=="NZL_2011"
replace A2038_1 =0 if D3013_A==5 & Z1004=="NZL_2011"
replace A2038_1 =1 if D3013_A>5  & Z1004=="NZL_2011"
replace A2038_1 =0 if D3013_A==.  & Z1004=="NZL_2011"
tab A2038_1 if Z1004=="NZL_2011"

replace A2038_2 =0 if D3013_B>5 & Z1004=="NZL_2011"
replace A2038_2 =0 if D3013_B==5 & Z1004=="NZL_2011"
replace A2038_2 =1 if D3013_B<5  & Z1004=="NZL_2011"
replace A2038_2 =0 if D3013_B==.  & Z1004=="NZL_2011"
*list A2038_2 D3013_B if Z1004=="NZL_2011"
tab A2038_2 if Z1004=="NZL_2011"

replace A2038_3 =0 if D3013_C>5 & Z1004=="NZL_2011"
replace A2038_3 =0 if D3013_C==5 & Z1004=="NZL_2011"
replace A2038_3 =1 if D3013_C<5  & Z1004=="NZL_2011"
replace A2038_3 =0 if D3013_C==.  & Z1004=="NZL_2011"
tab A2038_3 if Z1004=="NZL_2011"
*list D3013_C A2038_3 if Z1004=="NZL_2011"

replace A2038_4 =0 if D3013_D<5 & Z1004=="NZL_2011"
replace A2038_4 =1 if D3013_D==5 & Z1004=="NZL_2011"
replace A2038_4 =1 if D3013_D>5  & Z1004=="NZL_2011"
replace A2038_4 =0 if D3013_D==.  & Z1004=="NZL_2011"
*list D3013_D A2038_4 if Z1004=="NZL_2011"
tab A2038_4 if Z1004=="NZL_2011"

replace A2038_5 =1 if D3013_F>5 & Z1004=="NZL_2011"
replace A2038_5 =0 if D3013_F==5 & Z1004=="NZL_2011"
replace A2038_5 =0 if D3013_F<5  & Z1004=="NZL_2011"
replace A2038_5 =0 if D3013_F==.  & Z1004=="NZL_2011"
*list D3013_F A2038_5 if Z1004=="NZL_2011"
tab A2038_5 if Z1004=="NZL_2011"

replace A2038_6 =1 if D3013_H>5 & Z1004=="NZL_2011"
replace A2038_6 =0 if D3013_H==5 & Z1004=="NZL_2011"
replace A2038_6 =0 if D3013_H<5  & Z1004=="NZL_2011"
replace A2038_6 =0 if D3013_H==.  & Z1004=="NZL_2011"
*list D3013_E A2038_5 if Z1004=="NZL_2011"
tab A2038_6 if Z1004=="NZL_2011"

replace A2038_7 =0 if D3013_G>5 & Z1004=="NZL_2011"
replace A2038_7 =0 if D3013_G==5 & Z1004=="NZL_2011"
replace A2038_7 =1 if D3013_G<5  & Z1004=="NZL_2011"
replace A2038_7 =0 if D3013_G==.  & Z1004=="NZL_2011"
*list D3013_G A2038_5 if Z1004=="NZL_2011"
tab A2038_7 if Z1004=="NZL_2011"

replace A2038_8 =1 if D3013_I>5 & Z1004=="NZL_2011"
replace A2038_8 =0 if D3013_I==5 & Z1004=="NZL_2011"
replace A2038_8 =0 if D3013_I<5  & Z1004=="NZL_2011"
replace A2038_8 =0 if D3013_I==.  & Z1004=="NZL_2011"
*list D3013_G A2038_5 if Z1004=="NZL_2011"
tab A2038_8 if Z1004=="NZL_2011"

*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7+A2038_8)/8 if Z1004=="NZL_2011"
tab A2038 if Z1004=="NZL_2011"

**version iii
**Party A
replace A2039_1 = D5017_A-D3013_A if Z1004=="NZL_2011"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="NZL_2011"
tab  A2039_1 if Z1004=="NZL_2011"
***missings
sum D3013_A if Z1004=="NZL_2011"
replace A2039_1_b = D5017_A-D3013_A if Z1004=="NZL_2011"
replace A2039_1_b= D5017_A-(7.3+2.15) if D3013_A==. & Z1004=="NZL_2011"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="NZL_2011"
tab  A2039_1_b if Z1004=="NZL_2011"

**Party B
replace A2039_2 = D5017_B-D3013_B if Z1004=="NZL_2011"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="NZL_2011"
tab  A2039_2 if Z1004=="NZL_2011"
***missings
sum D3013_B if Z1004=="NZL_2011"
replace A2039_2_b = D5017_B-D3013_B if Z1004=="NZL_2011"
replace A2039_2_b= D5017_B-(3.3+2.11) if D3013_B==. & Z1004=="NZL_2011"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="NZL_2011"
tab  A2039_2_b if Z1004=="NZL_2011"

**Party C
replace A2039_3 = D5017_C-D3013_C if Z1004=="NZL_2011"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="NZL_2011"
tab  A2039_3 if Z1004=="NZL_2011"
***missings
sum D3013_C if Z1004=="NZL_2011"
replace A2039_3_b = D5017_C-D3013_C if Z1004=="NZL_2011"
replace A2039_3_b= D5017_C-(3.1+2.06) if D3013_C==. & Z1004=="NZL_2011"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="NZL_2011"
tab  A2039_3_b if Z1004=="NZL_2011"

**Party D
replace A2039_4 = D5017_D-D3013_D if Z1004=="NZL_2011"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="NZL_2011"
tab  A2039_4 if Z1004=="NZL_2011"
***missings
sum D3013_D if Z1004=="NZL_2011"
replace A2039_4_b = D5017_D-D3013_D if Z1004=="NZL_2011"
replace A2039_4_b= D5017_D-(5.12+3.37) if D3013_D==. & Z1004=="NZL_2011"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="NZL_2011"
tab  A2039_4_b if Z1004=="NZL_2011"

**Party F
replace A2039_5 = D5017_F-D3013_F if Z1004=="NZL_2011"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="NZL_2011"
tab  A2039_5 if Z1004=="NZL_2011"
***missings
sum D3013_F if Z1004=="NZL_2011"
replace A2039_5_b = D5017_F-D3013_F if Z1004=="NZL_2011"
replace A2039_5_b= D5017_F-(3.7+2.2) if D3013_F==. & Z1004=="NZL_2011"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="NZL_2011"
tab  A2039_5_b if Z1004=="NZL_2011"

**Party I
replace A2039_6 = D5017_I-D3013_I if Z1004=="NZL_2011"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="NZL_2011"
tab  A2039_6 if Z1004=="NZL_2011"
***missings
sum D3013_I if Z1004=="NZL_2011"
replace A2039_6_b = D5017_I-D3013_I if Z1004=="NZL_2011"
replace A2039_6_b= D5017_I-(5.77+2.37) if D3013_I==. & Z1004=="NZL_2011"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="NZL_2011"
tab  A2039_6_b if Z1004=="NZL_2011"

**Party G
replace A2039_7 = D5017_G-D3013_G if Z1004=="NZL_2011"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="NZL_2011"
tab  A2039_7 if Z1004=="NZL_2011"
***missings
sum D3013_G if Z1004=="NZL_2011"
replace A2039_7_b = D5017_G-D3013_G if Z1004=="NZL_2011"
replace A2039_7_b= D5017_G-(2.17+2.52) if D3013_G==. & Z1004=="NZL_2011"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="NZL_2011"
tab  A2039_7_b if Z1004=="NZL_2011"

**Party H
replace A2039_8 = D5017_H-D3013_H if Z1004=="NZL_2011"
replace A2039_8= A2039_8/-1 if A2039_8<0 & Z1004=="NZL_2011"
tab  A2039_8 if Z1004=="NZL_2011"
***missings
sum D3013_H if Z1004=="NZL_2011"
replace A2039_8_b = D5017_H-D3013_G if Z1004=="NZL_2011"
replace A2039_8_b= D5017_H-(7.27+3.14) if D3013_H==. & Z1004=="NZL_2011"
replace A2039_8_b= A2039_8_b/-1 if A2039_8_b<0 & Z1004=="NZL_2011"
tab  A2039_8_b if Z1004=="NZL_2011"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7+A2039_8)/8 if Z1004=="NZL_2011"
sum A2039 if Z1004=="NZL_2011"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b+A2039_8_b)/8 if Z1004=="NZL_2011"
sum  A2039_B if Z1004=="NZL_2011"

****************************************************************************************
***CHE_2011
sum D5017_A D5017_B D5017_C D5017_D D5017_E D5017_F D5017_G D5017_H D5017_I if Z1004=="CHE_2011" 
sum D3013_A D3013_B D3013_C D3013_D D3013_E D3013_F D3013_G D3013_H D3013_I if Z1004=="CHE_2011" 

tab D3013_A if Z1004=="CHE_2011", mis
tab D3013_B if Z1004=="CHE_2011", mis
tab D3013_C if Z1004=="CHE_2011", mis
tab D3013_D if Z1004=="CHE_2011", mis
tab D3013_E if Z1004=="CHE_2011", mis
tab D3013_F if Z1004=="CHE_2011", mis
tab D3013_G if Z1004=="CHE_2011", mis

mvdecode D3013_A, mv(95, 96, 97, 98, 99), if Z1004=="CHE_2011"
mvdecode D3013_B, mv(95, 96, 97, 98, 99), if Z1004=="CHE_2011"
mvdecode D3013_C, mv(95, 96, 97, 98, 99), if Z1004=="CHE_2011"
mvdecode D3013_D, mv(95, 96, 97, 98, 99), if Z1004=="CHE_2011"
mvdecode D3013_F, mv(95, 96, 97, 98, 99), if Z1004=="CHE_2011"
mvdecode D3013_G, mv(95, 96, 97, 98, 99), if Z1004=="CHE_2011"
mvdecode D3013_E, mv(95, 96, 97, 98, 99), if Z1004=="CHE_2011"


**i) respondents� ordering of sequences of political parties:A<B<C<D. 
*7 parties 
**EBFDCGA
replace A2037_1 =1 if D3013_E< D3013_B & Z1004=="CHE_2011"
replace A2037_1 =0 if D3013_E> D3013_B & Z1004=="CHE_2011"
replace A2037_1 =0 if D3013_E == D3013_B & Z1004=="CHE_2011"
replace A2037_1 =0 if D3013_E ==. & Z1004=="CHE_2011"
replace A2037_1 =0 if D3013_B ==. & Z1004=="CHE_2011"
*list A2037_1 D3013_F D3013_C if Z1004=="CHE_2011"
tab A2037_1 if Z1004=="CHE_2011", miss

replace A2037_2 =1 if D3013_B< D3013_F & Z1004=="CHE_2011"
replace A2037_2 =0 if D3013_B> D3013_F & Z1004=="CHE_2011"
replace A2037_2 =0 if D3013_B == D3013_F & Z1004=="CHE_2011"
replace A2037_2 =0 if D3013_B ==. & Z1004=="CHE_2011"
replace A2037_2 =0 if D3013_F ==. & Z1004=="CHE_2011"
*list A2037_2 D3013_A D3013_B if Z1004=="CHE_2011"
tab A2037_2 if Z1004=="CHE_2011"

replace A2037_3 =1 if D3013_F< D3013_D & Z1004=="CHE_2011"
replace A2037_3 =0 if D3013_F> D3013_D & Z1004=="CHE_2011"
replace A2037_3 =0 if D3013_F == D3013_D & Z1004=="CHE_2011"
replace A2037_3 =0 if D3013_F ==. & Z1004=="CHE_2011"
replace A2037_3 =0 if D3013_D ==. & Z1004=="CHE_2011"
*list A2037_3 D3013_D D3013_B if Z1004=="CHE_2011"
tab A2037_3 if Z1004=="CHE_2011"

replace A2037_4 =1 if D3013_C< D3013_D & Z1004=="CHE_2011"
replace A2037_4 =0 if D3013_C> D3013_D & Z1004=="CHE_2011"
replace A2037_4 =0 if D3013_C == D3013_D & Z1004=="CHE_2011"
replace A2037_4 =0 if D3013_C ==. & Z1004=="CHE_2011"
replace A2037_4 =0 if D3013_C ==. & Z1004=="CHE_2011"
*list A2037_4 D3013_F D3013_D if Z1004=="CHE_2011"
tab A2037_4 if Z1004=="CHE_2011"

replace A2037_5 =0 if D3013_C< D3013_G & Z1004=="CHE_2011"
replace A2037_5 =0 if D3013_C> D3013_G & Z1004=="CHE_2011"
replace A2037_5 =1 if D3013_C == D3013_G & Z1004=="CHE_2011"
replace A2037_5 =0 if D3013_C ==. & Z1004=="CHE_2011"
replace A2037_5 =0 if D3013_G ==. & Z1004=="CHE_2011"
*list A2037_5 D3013_C D3013_G if Z1004=="CHE_2011"
tab A2037_5 if Z1004=="CHE_2011", missing

replace A2037_6 =1 if D3013_G< D3013_A & Z1004=="CHE_2011"
replace A2037_6 =0 if D3013_G> D3013_A & Z1004=="CHE_2011"
replace A2037_6 =0 if D3013_G == D3013_A & Z1004=="CHE_2011"
replace A2037_6 =0 if D3013_G ==. & Z1004=="CHE_2011"
replace A2037_6 =0 if D3013_A ==. & Z1004=="CHE_2011"
*list A2037_6 D3013_F D3013_B if Z1004=="CHE_2011"
tab A2037_6 if Z1004=="CHE_2011", missing

replace A2037_7 =1 if D3013_E< D3013_A & Z1004=="CHE_2011"
replace A2037_7 =0 if D3013_E> D3013_A & Z1004=="CHE_2011"
replace A2037_7 =0 if D3013_E == D3013_A & Z1004=="CHE_2011"
replace A2037_7 =0 if D3013_E ==. & Z1004=="CHE_2011"
replace A2037_7 =0 if D3013_A ==. & Z1004=="CHE_2011"
*list A2037_7 D3013_C D3013_G if Z1004=="CHE_2011"
tab A2037_7 if Z1004=="CHE_2011", missing

***scale
replace A2037=(A2037_1+A2037_2+A2037_3+A2037_4+A2037_5+A2037_6+A2037_7)/7 if Z1004=="CHE_2011"
tab A2037 if Z1004=="CHE_2011"

*ii)correct placement of parties on the left-right is following the 
*7 parties
replace A2038_1 =0 if D3013_A<5 & Z1004=="CHE_2011"
replace A2038_1 =0 if D3013_A==5 & Z1004=="CHE_2011"
replace A2038_1 =1 if D3013_A>5  & Z1004=="CHE_2011"
replace A2038_1 =0 if D3013_A==.  & Z1004=="CHE_2011"
tab A2038_1 if Z1004=="CHE_2011"

replace A2038_2 =0 if D3013_B>5 & Z1004=="CHE_2011"
replace A2038_2 =0 if D3013_B==5 & Z1004=="CHE_2011"
replace A2038_2 =1 if D3013_B<5  & Z1004=="CHE_2011"
replace A2038_2 =0 if D3013_B==.  & Z1004=="CHE_2011"
*list A2038_2 D3013_B if Z1004=="CHE_2011"
tab A2038_2 if Z1004=="CHE_2011"

replace A2038_3 =1 if D3013_C>5 & Z1004=="CHE_2011"
replace A2038_3 =0 if D3013_C==5 & Z1004=="CHE_2011"
replace A2038_3 =0 if D3013_C<5  & Z1004=="CHE_2011"
replace A2038_3 =0 if D3013_C==.  & Z1004=="CHE_2011"
tab A2038_3 if Z1004=="CHE_2011"
*list D3013_C A2038_3 if Z1004=="CHE_2011"

replace A2038_4 =0 if D3013_D<5 & Z1004=="CHE_2011"
replace A2038_4 =0 if D3013_D==5 & Z1004=="CHE_2011"
replace A2038_4 =1 if D3013_D>5  & Z1004=="CHE_2011"
replace A2038_4 =0 if D3013_D==.  & Z1004=="CHE_2011"
*list D3013_D A2038_4 if Z1004=="CHE_2011"
tab A2038_4 if Z1004=="CHE_2011"

replace A2038_5 =0 if D3013_F>5 & Z1004=="CHE_2011"
replace A2038_5 =1 if D3013_F==5 & Z1004=="CHE_2011"
replace A2038_5 =0 if D3013_F<5  & Z1004=="CHE_2011"
replace A2038_5 =0 if D3013_F==.  & Z1004=="CHE_2011"
*list D3013_F A2038_5 if Z1004=="CHE_2011"
tab A2038_5 if Z1004=="CHE_2011"

replace A2038_6 =0 if D3013_E>5 & Z1004=="CHE_2011"
replace A2038_6 =0 if D3013_E==5 & Z1004=="CHE_2011"
replace A2038_6 =1 if D3013_E<5  & Z1004=="CHE_2011"
replace A2038_6 =0 if D3013_E==.  & Z1004=="CHE_2011"
*list D3013_E A2038_5 if Z1004=="CHE_2011"
tab A2038_6 if Z1004=="CHE_2011"

replace A2038_7 =1 if D3013_G>5 & Z1004=="CHE_2011"
replace A2038_7 =0 if D3013_G==5 & Z1004=="CHE_2011"
replace A2038_7 =0 if D3013_G<5  & Z1004=="CHE_2011"
replace A2038_7 =0 if D3013_G==.  & Z1004=="CHE_2011"
*list D3013_G A2038_5 if Z1004=="CHE_2011"
tab A2038_7 if Z1004=="CHE_2011"


*scale
replace A2038=(A2038_1+A2038_2+A2038_3+A2038_4+A2038_5+A2038_6+A2038_7)/7 if Z1004=="CHE_2011"
tab A2038 if Z1004=="CHE_2011"

**version iii
**Party A
replace A2039_1 = D5017_A-D3013_A if Z1004=="CHE_2011"
replace A2039_1= A2039_1/-1 if A2039_1<0 & Z1004=="CHE_2011"
tab  A2039_1 if Z1004=="CHE_2011"
***missings
sum D3013_A if Z1004=="CHE_2011"
replace A2039_1_b = D5017_A-D3013_A if Z1004=="CHE_2011"
replace A2039_1_b= D5017_A-(8.32+2.44) if D3013_A==. & Z1004=="CHE_2011"
replace A2039_1_b= A2039_1_b/-1 if A2039_1_b<0 & Z1004=="CHE_2011"
tab  A2039_1_b if Z1004=="CHE_2011"

**Party B
replace A2039_2 = D5017_B-D3013_B if Z1004=="CHE_2011"
replace A2039_2= A2039_2/-1 if A2039_2<0 & Z1004=="CHE_2011"
tab  A2039_2 if Z1004=="CHE_2011"
***missings
sum D3013_B if Z1004=="CHE_2011"
replace A2039_2_b = D5017_B-D3013_B if Z1004=="CHE_2011"
replace A2039_2_b= D5017_B-(2.76+2.07) if D3013_B==. & Z1004=="CHE_2011"
replace A2039_2_b= A2039_2_b/-1 if A2039_2_b<0 & Z1004=="CHE_2011"
tab  A2039_2_b if Z1004=="CHE_2011"

**Party C
replace A2039_3 = D5017_C-D3013_C if Z1004=="CHE_2011"
replace A2039_3= A2039_3/-1 if A2039_3<0 & Z1004=="CHE_2011"
tab  A2039_3 if Z1004=="CHE_2011"
***missings
sum D3013_C if Z1004=="CHE_2011"
replace A2039_3_b = D5017_C-D3013_C if Z1004=="CHE_2011"
replace A2039_3_b= D5017_C-(6.30+1.82) if D3013_C==. & Z1004=="CHE_2011"
replace A2039_3_b= A2039_3_b/-1 if A2039_3_b<0 & Z1004=="CHE_2011"
tab  A2039_3_b if Z1004=="CHE_2011"

**Party D
replace A2039_4 = D5017_D-D3013_D if Z1004=="CHE_2011"
replace A2039_4= A2039_4/-1 if A2039_4<0 & Z1004=="CHE_2011"
tab  A2039_4 if Z1004=="CHE_2011"
***missings
sum D3013_D if Z1004=="CHE_2011"
replace A2039_4_b = D5017_D-D3013_D if Z1004=="CHE_2011"
replace A2039_4_b= D5017_D-(5.37+1.63) if D3013_D==. & Z1004=="CHE_2011"
replace A2039_4_b= A2039_4_b/-1 if A2039_4_b<0 & Z1004=="CHE_2011"
tab  A2039_4_b if Z1004=="CHE_2011"

**Party F
replace A2039_5 = D5017_F-D3013_F if Z1004=="CHE_2011"
replace A2039_5= A2039_5/-1 if A2039_5<0 & Z1004=="CHE_2011"
tab  A2039_5 if Z1004=="CHE_2011"
***missings
sum D3013_F if Z1004=="CHE_2011"
replace A2039_5_b = D5017_F-D3013_F if Z1004=="CHE_2011"
replace A2039_5_b= D5017_F-(4.7+1.91) if D3013_F==. & Z1004=="CHE_2011"
replace A2039_5_b= A2039_5_b/-1 if A2039_5_b<0 & Z1004=="CHE_2011"
tab  A2039_5_b if Z1004=="CHE_2011"

**Party E
replace A2039_6 = D5017_E-D3013_E if Z1004=="CHE_2011"
replace A2039_6= A2039_6/-1 if A2039_6<0 & Z1004=="CHE_2011"
tab  A2039_6 if Z1004=="CHE_2011"
***missings
sum D3013_E if Z1004=="CHE_2011"
replace A2039_6_b = D5017_E-D3013_E if Z1004=="CHE_2011"
replace A2039_6_b= D5017_E-(3.26+1.94) if D3013_E==. & Z1004=="CHE_2011"
replace A2039_6_b= A2039_6_b/-1 if A2039_6_b<0 & Z1004=="CHE_2011"
tab  A2039_6_b if Z1004=="CHE_2011"

**Party G
replace A2039_7 = D5017_G-D3013_G if Z1004=="CHE_2011"
replace A2039_7= A2039_7/-1 if A2039_7<0 & Z1004=="CHE_2011"
tab  A2039_7 if Z1004=="CHE_2011"
***missings
sum D3013_G if Z1004=="CHE_2011"
replace A2039_7_b = D5017_G-D3013_G if Z1004=="CHE_2011"
replace A2039_7_b= D5017_G-(3.1+1.95) if D3013_G==. & Z1004=="CHE_2011"
replace A2039_7_b= A2039_7_b/-1 if A2039_7_b<0 & Z1004=="CHE_2011"
tab  A2039_7_b if Z1004=="CHE_2011"


**scale wihtout missings
replace A2039= (A2039_1+A2039_2+A2039_3+A2039_4+A2039_5+A2039_6+A2039_7)/7 if Z1004=="CHE_2011"
sum A2039 if Z1004=="CHE_2011"
***scale missings Gordon/segura
replace A2039_B= (A2039_1_b+A2039_2_b+A2039_3_b+A2039_4_b+A2039_5_b+A2039_6_b+A2039_7_b)/7 if Z1004=="CHE_2011"
sum  A2039_B if Z1004=="CHE_2011"
****************************************************************************************

**dropping components
drop A2037_1 A2037_2 A2037_3 A2037_4 A2037_5 A2037_6 A2037_7 A2037_8 A2038_1 A2038_2 A2038_3 A2038_4 A2038_5 A2038_6 A2038_7 A2038_8 A2039_1 A2039_2 A2039_3 A2039_4 A2039_5 A2039_6 A2039_7 A2039_8 A2039_1_b A2039_2_b A2039_3_b A2039_4_b A2039_5_b A2039_6_b A2039_7_b A2039_8_b
label variable A2037 "PLACEMENT KNOWLEDGE, correct order of parties, A<B<C<D<E"
label variable A2038 "PLACEMENT KNOWLEDGE, correct placement either left, right, center"
label variable A2039 "PLACEMENT KNOWLEDGE, correct scoring of each parties, no missings"
label variable A2039_B "PLACEMENT KNOWLEDGE,correct scoring of each parties, missings coded like Gordon/Segura 1997"

